This one's nice and simple: there are only two string operators. The first one is called the concatenation operator ".
", which combines the value of the right argument with the left argument. Let's look at it like this:
$a = "Hola "; $b = $a . "Mi Amigos!"; echo $b; // This prints "Hola Mi Amigos!"
The second operator is the concatenating assignment operator ".=
", which appends the value in the right with the value in the left, like this:
$a = "Hola "; $a .= "Mi Amigos!"; echo $a; // This prints "Hola Mi Amigos!"
The concatenating assignment operator is considered an "Assignment Operator" which we will be learning more about in the next lecture.
Feel free to experiment with the above string operators with some PHP using the practice.php page provided in this folder.