I actually used this operator to add two or more characters consecutively, as an example before a few lessons. You may not have understood there. But now we’ll correct this lack.

We will use the “.”(Dot) operator to combine texts and other values side by side and add them to other values. Let me show you an example again:

<?php
$name = 'Baransel';
$message = 'Hello';
$result = $message. $name;
echo $result;
?>

It will print Hello Baransel. Here we have added the $message variable and the $name variable side by side to the $result variable.

Let me show you another example:

<?php
$name = 'Baransel';
$result = 'Hello' . $name;
echo $result;
?>

This time it writes the same thing. What we did differently; Instead of using the $message variable, we gave our direct message to the result variable and combined the dot operator with the $name variable.