What difference does it makes when I use '' against "" ?
For example:
$example = 'Merry Christmas in Advance';
$eg = "Merry Christmas";
echo "$example";
echo '$example';
echo "$eg";
echo '$eg';
What would the output for each echo statements and what can we infer about '' vs "" in PHP ?
would produce:
Merry Christmas in Advance$exampleMerry Christmas$egSingle quoted strings are handled literally. No special characters (such as
\n) or variables are interpolated.Double quoted strings will interpolate your variables and special characters and render them accordingly.