Hi Michael,

Allow else blocks to follow iteration blocks.  The else block is executed
if no iteration occurs for any reason.

I also thought it would been a good idea, but most of the time i need a
wrapper in the output like this:

    if($items) {
        echo '<ul>';
        foreach($items as $item) {
            echo '<li>', $item, '</li>';
        }
        echo '</ul>'
    }


And this may change the behavior of:

    if($result)
        foreach($items as $item)
            var_dump($item);
    else
        echo 'Nothing';

from:

    if($result) {
        foreach($items as $item) {
            var_dump($item);
        }
    }
    else {
        echo 'Nothing';
    }

to:

    if($result) {
        foreach($items as $item) {
            var_dump($item);
        }
        else {
            echo 'Nothing';
        }
    }


I believe this change is only possible (useful or not) if the curly braces are always required.


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

Reply via email to