PHP - Strings Concatenation operator

Introduction

There is an operator for strings . which concatenates two strings or two variables transformed to a string when possible.

In the following example, the last statement will concatenate all the strings and variables forming the sentence.

Demo

<?php
     $firstname = 'Jason'; 
     $surname = 'Smith'; 
     echo 'I am ' . $firstname . ' ' . $surname . '!'; 
?>/* w  w  w  .  ja va 2s .com*/

Result