When and how should the concatenation operator (.) be used in PHP code, as seen in the provided example?

The concatenation operator (.) in PHP is used to combine two strings together. It is commonly used when you want to merge two strings into one. In the provided example, the concatenation operator is used to combine a variable containing a string with a fixed string to create a new string. Example:

$name = "John";
$greeting = "Hello, " . $name . "! How are you?";
echo $greeting;