Re: Re: [PEPr] Comment on Web Services::Services_Memotoo
| From: | Ken Guest | Date: | Wed, 23 Apr 2008 07:25:02 +0000 |
| Subject: | Re: Re: [PEPr] Comment on Web Services::Services_Memotoo | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-49862@lists.php.net to get a copy of this message | ||
On Wed, Apr 23, 2008 at 1:22 AM, Philippe Jausions <
Philippe.Jausions@11abacus.com> wrote:
>
> I guess then. I'm used to always put {} around control blocks and also
> assumed (apparently wrongly) that was part of the PEAR CS.
>
> So I'm surprised to see that:
>
> <?php
> $j=0;
> for ($i=1;$i<10;++$i)
> if ($j==$i)
> ++$j;
> ?>
>
> is actually valid code CS-wise (with just a warning for $j=0). To be
> valid, I'd always thought, the code above should have been written:
>
> <?php
> $j = 0;
> for ($i = 1; $i < 10; ++$i) {
> if ($j == $i) {
> ++$j;
> }
> }
> ?>
In all honesty I am very surprised that this isn't a part of the PEAR Coding
Standards - the additional braces certainly make the code more
readable and also makes for less maintenance problems.
k.