There are two string operators for concatenating two string.
Operator | Description | Example | Result |
---|---|---|---|
. | Concatenation | $str1 . $str2 | Concatenation of $str1 and $str2 |
.= | Concatenation assignment | $str1 .= $str2 | Appends the $str2 to the $str1 |
<?php $a = "Hello "; $b = $a . "World!"; // $b = "Hello World!" $a = "Hello "; $a .= "World!"; // $a = "Hello World!" ?>