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 . '!'; 
?>//  www  .j  a v  a 2 s.  c o  m

Result