Concatenation is the operation of joining two character strings/variables together. In PHP we use . (dot) to join
two strings.
Below are some examples of string concatenation:
<?php
echo "Hello "."there!";
echo "My"." "."name"."is"." "."Mike";
?>
Output
Hello there!
My name is Mike
Below are some examples of string concatenation including variables:
<?php
$message = "Hello there!";
$name = "Mike";
$age = 19;
echo $message;
echo "My name is ".$name;
echo "I am ".$age;
?>
Output
Hello there!
My name is Mike
I am 19