How Append/Concatenation A String In PHP

Share Now

Share on facebook
Share on pinterest
Share on twitter
Share on linkedin
Share on email

*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

Nahid Mahamud

Nahid Mahamud

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