difference between ' ' and " "?

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
User avatar
heretic
Registered User
Posts: 33
Joined: Mon Mar 25, 2002 4:38 am

difference between ' ' and " "?

Post by heretic »

What is the difference between single quotatoin and double quotation? Some of the mods (included in phpBB2.0) were using double quotations (eg. pparse("xxx"))
Step aside everyone! Sensitive love letters are my speciality. "Dear Baby, Welcome to
Dumpsville. Population: you."
Kylecool
Registered User
Posts: 674
Joined: Sat Feb 02, 2002 3:51 am
Location: Southern California, U.S.A! GO USA!
Contact:

Post by Kylecool »

Nothing really, just if you use one you have to use it to close it as well. :) Also if you have like 's (apostrophie's), you have to use "so they won't get messed up. :P

-Kyle
VACATION UNTIL june 29TH or 30th. :)
- szo2 -
Registered User
Posts: 538
Joined: Tue Apr 30, 2002 3:29 pm
Location: Hong Kong
Contact:

Post by - szo2 - »

There are some significant differences... The single quote will not parse anything in it excape for \'. The double quote parses \n, \t, etc AND variables like $abc, etc.
jackqu7
Registered User
Posts: 97
Joined: Wed Jan 02, 2002 12:01 pm

Post by jackqu7 »

If you need to put a var in your string, i.e.

Code: Select all

"hello $name";
You must use double quotes.
If there are no vars in there you can increase speed by using single quotes, then the php parser doesn't have to go through a long string with no vars.
AbelaJohnB
Former Team Member
Posts: 5674
Joined: Fri Jul 06, 2001 11:56 pm

Post by AbelaJohnB »

jackqu7 wrote:

Code: Select all

"hello $name";



I believe a better way to do that would be:

Code: Select all

'hello ' . $name;


just my 2cents
jackqu7
Registered User
Posts: 97
Joined: Wed Jan 02, 2002 12:01 pm

Post by jackqu7 »

AbelaJohnB wrote:
jackqu7 wrote:

Code: Select all

"hello $name";



I believe a better way to do that would be:

Code: Select all

'hello ' . $name;


just my 2cents

yes, yes it would in practice. I was demonstrating how it could be done :)
Locked

Return to “2.0.x Support Forum”