String Concatenation Operator in php

Manipulating strings is such a core part of PHP applications that PHP has a separate string concatenation operator (.). The concatenation operator appends the righthand operand to the lefthand operand and returns the resulting string. Operands are first converted to strings, if necessary.

For example:

$n = 5;
$s = ‘There were ‘ . $n . ‘ ducks.’;
// $s is ‘There were 5 ducks’

The concatenation operator is highly efficient, because so much of PHP boils down to string concatenation

Leave a Comment