What does a . (dot) do in PHP?

On its own, that does nothing at all (it’s not valid syntax). However, if you have something like this:

<?php

$string1 = "Hello ";
$string2 = "world!";
$string = $string1 . $string2;

echo $string;

?>

You will see Hello world!. The . is the string concatenation operator.

Leave a Comment