PHP Tutorial Tutorials - PHP String Operators

PHP String Operators

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!"
?>
Date:2019-10-01 02:17:14 From:www.Lautturi.com author:Lautturi