difference between " and ' in php?

Zac G

New member
what is the difference between ' and " in php and why cant i do this
$shoutn = '$name \n $date'; only $shoutn = "$name \n $date";
 
There isn't a difference but you have to keep them the same (I think). I'm pretty sure once you use ' or " in it, you can't use the other.

Other than that, I don't think there is a difference.
 
When coding you can either use ' or " to declare strings. The single quote is better used to declare pure strings and by that I mean strings that will not include variables inside (even knowing that you can concatenate the string for that). The double quote is used to declare complex strings and by I mean strings that can have variables inside and complex declarations.

By definition a single quote string does not allow you to include a variable within, unless you are concatenating it.
 
Back
Top