PHP String Operators - String Operators in PHP
PHP String Operators
- PHP String Operators are operators used in PHP to manipulate strings. These operators are used to concatenate, compare, calculate the length of a string, and search for substrings.
- The PHP String Operators are:
- . (concatenation)
- .= (concatenation assignment)
Operator | Name | Syntax | Operation |
---|---|---|---|
. | Concatenation | $a.$b | Concatenated $a and $b |
.= | Concatenation and assignment | $a.=$b | First concatenates then assigns, same as $a = $a.$b |

Sample Code
<?php
$a = "Welcome";
$b = "to";
$c = "Wikitechy..!";
echo $a . $b . $c, "<br>";
$a .= $b . $c;
echo $a;
?>
Output
WelcometoWikitechy..!
WelcometoWikitechy..!