"Mike Ford" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > -----Original Message-----
> > From: Chris Earle [mailto:[EMAIL PROTECTED]]
> > Sent: 11 July 2002 18:28
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Re: if syntax
> >
> >
> > > when it would be just as easy, and more functional, to
> > write this (even
> > > saves a few characters, too!):
> > >
> > >    if (x):
> > >       while (y):
> > >          ...
> > >       endwhile;
> > >       ...
> > >    endif;
> >
> > You're adding characters...
> >
> > "{" + "}" opposed to ":" + "endif;"
>
> No, no, no!  Look again -- I was contrasting this with:
>
>    if (x) {
>       while (y) {
>          ...
>       } // end while
>       ...
>    } // end if
>
> which I see quite often in other people's scripts.
>
> Then the difference is " {" and "} // end if" as opposed to ":" and
> "endif;", and indeed you are saving characters -- and it's more
functional,
> because the PHP processor is getting to check the end* statements match
the
> correct block opener, rather than just matching back to the next unclosed
> "{" regardless of whether it's on an appropriate block opener or not.  To
> me, this is such a huge advantage that I just can't understand why people
> insist on sticking with the all-braces style, and that's regardless of the
> fact that I just think it's more readable.

Oh, just as the other guy said, I don't comment my braces because I tab in
everything evenly (each if is another tab with the nested code tabed one
further).  I do comment my functions end braces because they can get pretty
big and they're all at the same level of tabbing.

I think that most people (like me) use it because of their backgrounds in
other programming languages.  I learned PHP after I was doing a lot of C++
work ... so it came very naturely.

> Cheers!
>
> Mike
>
> ---------------------------------------------------------------------
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to