Echo & String Concatenation
echo can print several things separated by commas, or you
can join (concatenate) strings into one using the
. operator.
Example: building a full name
<?php
$first = "Chi";
$last = "nedu";
echo $first . $last;
?>
Chinedu
PHP uses . for string concatenation — worth noting
explicitly, since many other languages (JavaScript, Python) reuse
+ for the same job, and reaching for + out of
habit in PHP does something entirely different (numeric addition, which
usually produces an unexpected result or a warning when applied to text).
<?php
$first = "Chi";
$last = "nedu";
echo $first . $last;
?>
Chinedu