I have been programming PHP for a while, but I never full understood the quotes.
When is it better to use ' ' as opposed to " "?
eelixduppy
5:38 pm on Jun 16, 2006 (gmt 0)
Apparently using single quotes(') is faster than using double, but with the single quotes PHP will not parse variables within the quotes but just output the variable name. If you are going to place variables within a string, you have to use double quotes.
$fish = "blue fish"; echo 'I love $fish'; //prints I love $fish echo "I love $fish"; //prints I love blue fish //or echo 'I love '.$fish;
mcavic
8:52 pm on Jun 16, 2006 (gmt 0)
Agreed. I always use double quotes in PHP for that reason. That way, it also allows me to consistently use single quotes for html/javascript output. For example,