Wednesday, October 5, 2011

What is the difference between displaying a string in single quotes and double quotes in PHP?

1) With Single Quotes the performance is faster than double quotes because the PHP parser does not checks for any variables or special characters. Whatever is there it will display that.
2) With double quotes the parser will search for the variables embedded in the string.
3) Performance wise it is always better to use single quotes. And we can use the concatenation between the strings and the variables.
4) Double quotes recognizes the new line charactes like '\n','\t' etc.., where as single quotes does not.

No comments:

Post a Comment