Andi Gutmans wrote:

so you are replacing the question "where does it go to"
that can be answered with a string search wiht "where
does it break to"

This one alone justifies at least labeled breaks as
JAVA has them and that are a kind of restricted GOTO
(as you can also break out of an if)

The JAVA approach is even superior to PHPs "break n;"
where n has to be an integer and you have to be very
carefull to not wrap another loop around the break
but within the loop supposed to be broken


At 09:53 PM 7/30/2004 +0200, Edin Kadribasic wrote:
function pseudocode()
{
    $a=allocate_resource_z();
    $b=allocate_resource_y();

do {
    $res=do_stuff();
    if(!$res)
        break;

    $c=allocate_resource_x();
    $res=do_more_stuff();
    if(!$res)
        break;

    $d=allocate_resource_foo();
    $res=do_even_more_stuff();
    if(!$res)
        break;

    return true;
} while (0);

    free_resouce($a);
    free_resouce($b);
    if(isset($c)) free_resouce($c);
    if(isset($d)) free_resouce($c);

    return false;
}



--
Hartmut Holzgraefe  <[EMAIL PROTECTED]>

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



Reply via email to