Re: check a variable after EACH function

From: Date: Wed, 01 Jul 2009 07:36:19 +0000
Subject: Re: check a variable after EACH function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-294784@lists.php.net to get a copy of this message
On Tue, 30 Jun 2009 18:31:54 -0500, Flint Million wrote: > Suppose I have some kind of check variable - say for example > $abort_now. Or it could be a function. Something to be evaluated to a > value. > > I want to execute a block of statements, but after EACH statement > executes, check the value of $abort_now and if it is true, break; out > of the block. > > Here's an example > > do { > do_something(); > do_something_else(); > do_another_thing(); > do_yet_another_thing(); > and_keep_doing_things(); > } while ($abort_now != 1); I would have the functions return true or false and do something like: while (do_something() && do_something_else() && do_another_thing() && do_yet_another_thing() && and_keep_doing_things()) ; /Nisse

« previous php.general (#294784) next »