> -----Original Message----- > From: Chris W. Parker [mailto:[EMAIL PROTECTED] > Sent: 29 July 2003 17:56
[...snip...] > As opposed to the much easier to read (and line up curly > braces) method: > > function doit() > { > for() > { > if() > } > ... > } > else > { > ... > } > } > } Or the (IMVHO) even easier to read, even easier to match up, and producing more focussed error messages: function doit() { for(): if(): ... else: ... endif; endfor; } And yes, this is valid PHP -- it's the alternative control-structure syntax that is mentioned throughout the control structures section of the manual. The beauty here is that if you accidentally leave out (say) the endif, you'll get an error at the endfor (because the parser is expecting an endif!), not waaaay down at the bottom of the file when it just knows there's an unclosed brace from somewhere or other. I know the braces vs. end-token debate is almost on the scale of a holy war, and I admit to hating the curly-brace style with a passion, but when I see code like this: function doit() { for() { if() } ... } else { ... } // if } // for } I wonder why the heck the author didn't just go for the alternative syntax with proper end-tokens and get the added value they deliver. OK, I'll step back off my soap-box now ... ;) 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