I was wondering how can I print out whitespace in the following code below.
<?php echo "$first_name", "$last_name" ; ?>
I was wondering how can I print out whitespace in the following code below.
<?php echo "$first_name", "$last_name" ; ?>
Just, well, add whitespace to your output?
<?php echo "$first_name $last_name with some whitespace" ; ?>
Sometimes, it the obvious answer is right - even in PHP!
Notice that when you use ' any var aren't display, with " does.
So, good is:
<?php echo "$first_name $last_name" ; ?>
bad
<?php echo '$first_name $last_name' ; ?>
If you want to concatenate several strings without the double quotes (e.g. when using single quotes):
$string = $first_name . ' ' . $last_name; // The dot is a concatenation operator
If you want to keep using commas:
<?php echo $first_name, ' ', $last_name; ?>