How Append/Concatenation A String In PHP

Share Now

*In PHP there are two string operators.

1.Concatenation Operator (‘.’)
It returns the concatenation of its right and left arguments

$a = "Hello ";
$b = $a . "World!"; // now $b contains "Hello World!"

2.concatenating assignment operator (‘.=’)
It appends the argument on the right side to the argument on the left side

$a = "Hello ";
$a .= "World!"; // now $a contains "Hello World!"

#CODE EXAMPLE

Picture of Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert