-
Notifications
You must be signed in to change notification settings - Fork 293
Closed
Description
I searched and didn't see a previous issue for this. Do you think we should recommend using single quotes around any string that doesn't require some type of evaluation?
I'd propose that if a string is just a string, it should be surrounded by single quotes:
$testVariable1 = 'This is a plain string.'
$testVariable2 = 'This is a string containing a $variable I don't want evaluated'
$testVariable3 = "This is a string containing a $variable I want evaluated"
as opposed to:
$testVariable1 = "This is a plain string."
$testVariable2 = 'This is a string containing a $variable I don't want evaluated'
$testVariable3 = "This is a string containing a $variable I want evaluated"
I think this improves readability and is more consistent. Also, while the difference is very minimal, single quoted strings generally perform faster than double quoted strings when there is no expansion/evaluation.
A bit more info:
rkeithhill, dotps1, michaeltlombardi and ryanspletzer