[PHPwestoz] Order of execution

Adam Ashley adam_ashley at softhome.net
Mon Mar 14 18:52:01 UTC 2005


On Mon, 2005-03-14 at 13:15 +0800, Timothy White wrote:
> I'm building a simple php system and being the unix programmer I love to
> have functions and not have much code in the body.
> I want to do something like this
> function x(){}
> function y(){}
> function z(){}
> x() && y() && z()...
> So that each function will execute in turn but only if the previous
> function returns 1.
> I can do (x() && y()) && z() and get it kinda working but I'm sure there
> is an easier way.
> 

$result = (x() && y() && z());

would work. php will stop evaluating a conditional check as soon as is
able to return a definitive result.

Adam





More information about the PHPwestoz mailing list