PHP MYSQL - Operators - 5.6 String Operators
PHP String Operators
PHP has two operators that are specially designed for strings.
Operator | Name | Example | Result | |
---|---|---|---|---|
. | Concatenation | $txt1 . $txt2 | Concatenation of $txt1 and $txt2 | |
.= | Concatenation assignment | $txt1 .= $txt2 | Appends $txt2 to $txt1 |
<!DOCTYPE html>
<html>
<body>
<?php
$txt1 = "Vesrn";
$txt2 = "Technologies";
echo $txt1 . $txt2;
?>
</body>
</html>
Output:
VesrnTechnologies
2)<!DOCTYPE html>
<html>
<body>
<?php
$txt1 = "Vesrn;
$txt2 = "Technologies!";
$txt1 .= $txt2;
echo $txt1;
?>
</body>
</html>
Output:
VesrnTechnologies