|
|
|
PHP Tips
As far as I can guess is if you are using special characters, ie: end-of-line '\n' or as in the book, a tab char '\t', then you need to use ". Otherwise it doesn't matter.
Mostly, it's a convenience thing. ' can be easily enclosed in ":
"Mat's cat's father" works just fine. However 'Mat's cat's father' causes problems. There is always the ability to "escape" if you need a literal quote:
"She told me, \"Please don't look at me like that,\" and I didn't any more"
It doesn't work the other way - this fails:
'She told me, "Please don't look at me like that," and I didn't any more"
Essentially, it's all about "parsing" - how can the language interpret what it finds.
The BEST way to enclose string literals is ALWAYS with "" - it's the safest. It forces you to escape: \n\t\r\f (etc) and \" or \\ when you want those characters included.
Also true. Good research there.
That means that the following is handled differently:
$x="Mat";
$string = '$x Cantore' // = $x Cantore
$string2 = "$x Cantore" // = Mat Cantore
Single-quoted strings do not interpolate variables. Double-quoted strings interpolate variables and expand the many PHP escape sequences.
You may be interested in these Links
- Visit Uploadmega for news and information of
celebrities of Bollywood, Kollywood and Hollywood.
- Visit Newsforall for general news and technical titbits.
- Visit Myclickworld for free titbits on PC and programming.
- Visit Lottery-Zone for free info on Lottery
- Visit Onlinelotterystore for online lottery information.
- Visit Rubberfarmer for Rubuuer Cultivation and related information.
|
|
|