[PHPwestoz] Order of execution

Nicolas Connault nicou at sweetpeadesigns.com.au
Mon Mar 14 16:55:02 UTC 2005


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.

I'm sure that's not what you're looking for, but it's how I would do it:

if(x() == 1){
    if(y() == 1) z()
}

I think that's pretty minimal coding for the result you want.

Nicolas




More information about the PHPwestoz mailing list