A famous interview question for php:- What to use to initialize a string in php ? Single quotes(‘) or Double quotes(“) ?
You should know the difference between these two, for e.g.
$website = "http://www.ankurgupta.com/blog"; $doubleQuoteStr = "I love $website"; $singleQuoteStr = 'I love $website'; echo $doubleQuoteStr; echo $singleQuoteStr;
Output to above php script will be
I love http://www.ankurgupta.com/blog I love $website
String inside Double quotes is parsed for variables, so we should use Double Quotes when there is a possibility of using variables in future while when we want to store large static data in a variable then single quote is better and faster, as it is not parsed.