Forum Moderators: coopster

Message Too Old, No Replies

' vs " in echoes and strings

' or " in strings

         

xKillswitchx

12:04 am on Aug 29, 2007 (gmt 0)

10+ Year Member



I read something awhile back about deciding whether to use ' or " in echoes and a few other strings, but I can't remember where I found it and am getting bad results on Google for that.

Is it better to use ' or " in echoes and strings? If I can remember correctly, the way it was explained to me was that " in strings stores it for awhile in memory or something, while ' stores it just for that usage. I've also heard that using ' instead of " supposedly helps speed your application up a bit.

In any case, which should I be using? I've so far been using ' for most everything (unless " is needed).

eelixduppy

12:27 am on Aug 29, 2007 (gmt 0)



You will get your answer if you read the documentation for strings [us3.php.net].

Basically, you can use either one without any significant difference in speed. Technically double quotes would take longer because it has to look for variables within the string, but it shouldn't account for much.

phparion

4:44 am on Aug 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



and single quote won't support all escape characters and symbols

jatar_k

12:29 pm on Aug 29, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> so far been using ' for most everything (unless " is needed)

that's what I do