Re: PEAR CS poll
| From: | Justin Patrin | Date: | Sat, 09 Oct 2004 01:47:38 +0000 |
| Subject: | Re: PEAR CS poll | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-33730@lists.php.net to get a copy of this message | ||
On Fri, 08 Oct 2004 23:51:32 +0200, Klaus Guenther
<klaus@capitalfocus.org> wrote:
> Ian Eure wrote:
>
> > There are a few things which aren't covered by PEAR's CS. I'd like to
> > get the concensus of the PEAR dev community on these things.
> >
> > * String concatenation.
> > 1) "foo" . "bar"
> > 2) "foo"."bar"
> > 3) other (please describe)
>
>
> 3) preferably 1, but sometimes 2 is necessary when the lines would
> otherwise go over 80 cols. I'm not sure, though, that this is necessary
> to define. I'd prefer an 80 cols rule - with exeptions only where
> absolutely necessary :)
>
> I agree with the others about single quotes. For one thing, it makes it
> easier to read as there are less escaped characters. Also, I prefer
> having the variables outside of the quotes, especially when they are
> complex (e.g., $this->_myPrivateVariable, or even
> $this->getRealName($username)).
>
> But while the results of this vote my indicate a guideline for coding, I
> don't think it should be added to the CS section of the manual, as we
> don't want to put unecessary stuff in there.
>
> > * Assigning by reference.
> > 1) $foo = &$bar;
> > 2) $foo =& $bar;
> > 3) other (please describe)
>
>
> This only is valid for php4. php5, of course, returns a reference by
> default. That said...
>
No, this is still perfectly valid for non-object variables in PHP5 as:
$foo = 'bar';
$baz = $foo;
$baz = 'blah';
echo $foo;
will still echo 'bar' in PHP5.
> 2) please :)
>
> And this one doesn't need to be added to the manual, as it will soon be
> outdated.
>
--
paperCrane --Justin Patrin--