PHP How to concatenate the two strings
In this tutorial, we are going to learn about how to concatenate the two strings in PHP.
Concatenation means joining of two strings into a single string.
To concatenate the two strings, we can use the period .
concatenation operator in PHP.
Here is an example:
$first = "hello ";
$second = "king";
$result = $first . $second ;
echo $result
Output:
hello king
Similarly, we can also use .=
operator in PHP.
$name = "john ";
$name .= "james";
echo $name
Output:
john james