Re: Coding Std. [was: Re: [PHP-DOC] MySQL examples need review]
| From: | Philip Olson | Date: | Sun, 23 Dec 2001 20:36:07 +0000 |
| Subject: | Re: Coding Std. [was: Re: [PHP-DOC] MySQL examples need review] | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969340318@lists.php.net to get a copy of this message | ||
> > > $variables shoud be concatenated with '. instead of using "$var
> > > strng".
> > -1. I prefer "$var string".
>
> $var." string" is less ambigious. Actually it should be $var.' string' as
> "$var string" and '$var string' behave differently $var.' string'
> and $var."
> string" work the same.
-1 for worrying about this, both the following are fine with me:
$var . ' string'
"$var string"
On a related note, we should discuss arrays in strings too:
"a $arr[foo] b"
"a {$arr['foo']} b"
'a ' . $arr['foo'] . ' b';
I prefer the first but it will/may make some people feel not surrounding
keys with quotes is okay, it's not unless in a string otherwise
eventually a E_NOTICE error is created. Concatenation seems appropriate
here.
Regards,
Philip Olson