Concatenation
Concatenation operator concatenate right and left arguments.
$a = "a";
$b = "b";
echo $a . $b; // ab
Special
PHP has a special operator that can be used to concatenate two strings.
$a = "a";
$b = "b";
echo $a .= $b; // ab
# Using the + operator, like in Java ...
# will result in TypeError (PHP 8+)
echo $a += $b; // Unsupported operant types
Last update: 402 days ago