w3resource

PHP: String operator

String Operators

There are two string operators : concatenation operator ('.') and concatenating assignment operator ('.=').

Example : PHP string concatenation operator

<?php
$x = "Good";
$y = $x ." Morning";
// now $y contains "Good Morning "
echo $y;
?>

Output:

Good Morning

View the example in the browser

Example: PHP string concatenating assignment operator

<?php
$x = "Good";
$x.= " Morning";
echo $x;
?>

Output

Good Morning

View the example of in the browser

Previous: Bitwise Operators
Next: Array Operators



Follow us on Facebook and Twitter for latest update.