Not true try this code and learn the differnence <?php $var = 'Hello World'; echo '<p>output: $var</p>'; echo "<p>output: $var</p>"; ?> PHP:
using " will actually take slightly longer as php looks first for any variables inside the " while using single ones it will not parse the string.
Many programmer's forget about the difference about single and double quote. Thanks for your lovely example.
I never recommend using " (double quotes) when programming with PHP. Always use ' (single quotes) unless you need the features of " (double quotes) However, using single quotes forces variables to be outside the quotes; instead, you must use theperiod (.) to combine strings. It makes for faster coding Basically, when you start a string with either of the single or double quote marks, the string goes until it finds a matching quote. Having single-quotes inside a double-quoted string or double-quotes inside a single-quoted string does not end the string or start a new string, they are simply interpreted as characters. If double-quotes are used, variables are interpreted, while single-quoted strings do not interpret variables.
single quotes also don't interpret escapes sequences. the only escapes a single quote will in interpret is \' and \\ (assuming it is at the very end of the string and proceeded by the closing single quote).
with single quotes you can print a string with double quotes inside. with double quotes, you can print a string with single quotes inside but cant double quotes (needs escaping to work). The first one is more useful especially if you want to print something like this.. echo 'This is a <a href="example.com>double quote link</a> which can freely include double quotes without escaping '; echo "This is a 'single' quote but needs \"escaped\" double quotes"; PHP: Notice carefully (2) how you are using double quotes and again to print double quotes you will need to escape the double quotes else php will throw parse error.
Double quotes parse variables within, without the need to escape: $name = 'bob'; echo "Hi, my name is $name and I like coffee"; PHP: The above would print: Hi, my name is bob and I like coffee Single quotes literally echo what is inside the string: $name = 'bob'; echo 'Hi, my name is $name and I like coffee'; PHP: This would print: Hi, my name is $name and I like coffee You can also reference line breaks, tabs and carriage returns in double quotes: \n \t \r If you're not looking to print variables in this way (which you shouldn't do, it's bad practice) then use single quotes, it will be ever so slightly faster as PHP won't run the parsing engine on the string.