I am new in php,I know that i can wrap string wi single quotes(')
or with double quotes(")
.
what is the differnt and what is the best way to use?
Asked
Active
Viewed 52 times
-1

user2110292
- 3,637
- 7
- 22
- 22
-
Please at least attempt basic spelling. Seriously. This question is offensively lazy. – Lightness Races in Orbit Mar 14 '13 at 13:06
1 Answers
0
Wrap your string in single quotes (')
instead of double quotes (")
is faster because PHP searches for variables inside "…" and not in '…', use this when you’re not using variables you need evaluating in your string.

Mark Baker
- 209,507
- 32
- 346
- 385

One Man Crew
- 9,420
- 2
- 42
- 51
-
1What do you use to type those quotes? They're completely wrong :) but I'm curious how someone types those by accident. – Evert Mar 14 '13 at 13:05
-
@Evert: ISTR Windows has a global mode where you can set this. Though I've never found it. Of course Word has its own setting. – Lightness Races in Orbit Mar 14 '13 at 13:06
-
Faster isn't strictly accurate; even a string wrapped in '..' is parsed for escapes, so the speed difference between "..." and '...' is so small even your computer won't notice it – Mark Baker Mar 14 '13 at 13:09