Re: [PHP] control structure question

2002-07-25 Thread Miguel Cruz
On Tue, 23 Jul 2002, Javier Montserat wrote: So refering back, i re-wrote the original example using the switch syntax... switch (true) { case doStep1(): case doStep2(): case doStep3(): error(); break; default: valid(); } Each case expressions is evaluated, until one of them

[PHP] control structure question

2002-07-23 Thread Javier Montserat
is there a more programmatically elegant way of saying... $isError = ; function main() { doStep1(); if (!$isError) { doStep2(); } if (!$isError) { doStep3(); } // etc. etc. } function doStep1() { if ($something) { $isError = 1; } }

Re: [PHP] control structure question

2002-07-23 Thread Martin Clifford
For steps and sequences, I always use switches. Most commonly associated with the action variable, it would look like this: switch($action) { default: // what to show if no variable exists, or is set to a value // that is not acceptable below break; case add_file: //

Re: [PHP] control structure question

2002-07-23 Thread Javier Montserat
So refering back, i re-wrote the original example using the switch syntax... switch (true) { case doStep1(): case doStep2(): case doStep3(): error(); break; default: valid(); } Each case expressions is evaluated, until one of them evaluates to a value equal (==) to the switch expression