On Thu, May 03, 2007 at 08:36:00AM -0400, Sean Bright wrote:
> This fails the "Make PHP code easier to read" test I think.  But it passes
> the "I'm a lazy programmer" test with flying colors! ;-)
> 
> I mean seriously, what real value does this add to the language?  Its just
> syntactic sugar to save yourself a few keystrokes.

* Less code - smaller compiled code
* Only do the test once, without the need of extra variables/...

I wonder if this should also be done on foreach:

foreach($someArray as $key => $value) {
    echo "key=$key value=$value\n";
} else {
    echo "someArray is empty";
}

$someArray could have been a function call.


Also should this happen with the alternative syntax:

while($i <= 10) :
    echo $i++;
else:
    echo "The while couldn't be executed!";
endwhile;

-- 
Alain Williams
Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to