Re: While-else

From: Date: Wed, 02 May 2007 19:10:32 +0000
Subject: Re: While-else
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-29131@lists.php.net to get a copy of this message
On Sat, April 28, 2007 1:03 pm, Pelle Ravn Rosfeldt wrote: > Is it possible to make a "while" with a "else"-statement in PHP6? > I know that it's not the first time this subject is up, but my > research > shows that a lot of people miss it. Including me. > > Here's an example of what I mean: > --------------------- > <? > $i = 1; > while ($i <= 10) { > echo $i++; > } else { > echo "The while couldn't be executed!"; > } > ?> > --------------------- So it executes after the last iteration? No. It must only execute if there were no iterations?... Maybe I'm just an old fart, but I don't like it... :-v -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.internals (#29131) next »