PHP String Operators With Example

String Operators:

PHP has two operators that are specially designed for strings.

They are concatenation (.) and concatenation assignment (.=).

The concatenation operator concatenates two strings. Eg: $str1.$str2.

The concatenation assignment operator(.=) assigns one string to another. Eg: $str1=$str2.

List of String Operators:

Operator Description Example Result
. Concatenation $str1 . $str2 Concatenation of $str1 and $str2
.= Concatenation assignment $str1 .= $str2 Appends the $str2 to the $str1



Welcome to : aimtocode!
Welcome to : aimtocode!

Read Also: