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 ww w .jav a2s . c  o m

Result