
Many people seem to be confused with the use of quotes and apostrophes when coding in PHP.
Using apostrophes is the “lightweight” way. Use these when you just want to create a string:
$var = 'This is just plain old text.';
Using quotes will provide you with a bit more functionality and in turn is slightly more expensive in execution:
{code type=php} # Use \n to add a new line
$var = “This is the first line\nThis is the second line”;{/code} {code type=php} # Include the value of a variable
$var = ‘bones’;
echo “Don’t rattle my $var”;{/code}
Please note also that PHP will evaluate any text in quotes – it is therefore more efficient to use apostrophes by default and use quotes only when you need them.