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 evaluates to a value > equal (==) to the switch expression (in this case a boolean error flag). > > The error() code will only be called if one of the doStep() evaluates to > false. > > And the valid() code will only be evaluated if the switch reached the > default, which means that none of the above check returned false > > I think for this example the switch syntax is more elegant than using a > series of if() statements.
That's pretty clever! miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php