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 . '!'; 
?>//from w  w w .  j  a  va  2s  .co  m

Result