What does the .= operator mean in PHP?

codacopia picture codacopia · Feb 13, 2013 · Viewed 39.9k times · Source

I have a variable that is being defined as

$var .= "value";

How does the use of the dot equal function?

Answer

Blender picture Blender · Feb 13, 2013

It's the concatenating assignment operator. It works similarly to:

$var = $var . "value";

$x .= differs from $x = $x . in that the former is in-place, but the latter re-assigns $x.