Page 1 of 1

PHP echo single quote & double quote confusion

Posted: Wed Jan 20, 2010 10:12 pm
by Neo
People especially newbies are sometimes confused with the single and double quotes in echo function. Here is a good example to understand the behaviours of this.

Code: Select all

<?php
$color = "red";
echo "Roses are $color";
echo "<br />";
echo 'Roses are $color';
?>
The output of the code above will be:
Roses are red
Roses are $color