> -----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.

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