It can save you one if-statement, where the condition would be identical to
the where condition.
Example:
if ($i <= 10)
{
while ($i <= 10)
{
$i++;
}
}
else
{
echo "$i is more than 10\n";
}
I personally hate overspecifications, and this is one situation where that's
the case. So actually, I would like while-else support. Just my humble 2
futile cents of course.
Regards,
Ron
""Richard Lynch"" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> 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?
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php