Whenever we assign any String value to a variable, it must be enclosed in single quotes i.e ( ' ) or double quotes i.e ( " ). But there is a difference in single quotes and double quotes. Below here i am going to explain with the help of codes, please have a look.
Code
<?php
$first_name='Saurabh';
$show1="Hello guys my first name is $first_name.";
$last_name='Sharma';
$show2='Hello guys my last name is $last_name.';
echo $show2;
?>
Output Will be :
Hello guys my last name is $last_name.
But if we wish to print varible $show1 then :-
<?php
$first_name='Saurabh';
$show1="Hello guys my first name is $first_name.";
$last_name='Sharma';
$show2='Hello guys my last name is $last_name.';
echo $show1;
?>
Output Will be :
Hello guys my first name is Saurabh.
Single Quotes : It is used just for assigning the variable.
Double Quotes : It is basically used for Variable Expansion.