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



PHP: Tips of the Day

PHP: Remove first 4 characters of a string with PHP

You could use the substr function to return a substring starting from the 5th character:

$str = "The quick brown fox jumps over the lazy dog."
$str2 = substr($str, 4); // "quick brown fox jumps over the lazy dog."

Ref : https://bit.ly/2LJDLQx