
PHP: Single Quotes versus Double Quotes - endyourif
http://www.endyourif.com/php-single-quotes-versus-double-quotes/
======
lomegor
Although I understand that you want something to run faster, preemptive
optimization is not always the best solution. It can lead to bad code and to
weird behaviour. For example, arrays and especially associative arrays should
not go inside double quotes, most of the times (I'm not sure if it's even
possible). That way, double quotes are only useful with single variables,
meaning that sometimes, even with double quotes, you would need to use
concatenation.

And that's not even taking into account sanitation, because with double quotes
it's easier to avoid it, and harder to notice.

I prefer choosing one of those types of quotes and sticking to it throughout
the code. It makes code more readable and makes it easier to notice bugs and
optimization problems.

~~~
MrEnigma
For double quotes you can use curly braces instead of concatenation. $foo = "I
like {$hacker['news']}"; depending on how you want it evaluated you can drop
the dollar sign on the outside of the curly brackets as well.

------
pan69
Regardless of speed, I tend to use single quotes for keys and double quotes
for text. E.g.

'key' => "Hello world"

Sometimes text needs escape characters such as \n or you want to include a
variable. Double quotes just make that easier.

