While-else
| From: | Pelle Ravn Rosfeldt | Date: | Sat, 28 Apr 2007 18:03:38 +0000 |
| Subject: | While-else | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-29092@lists.php.net to get a copy of this message | ||
Hi there.
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!";
}
?>
---------------------
Python & Perl already have this function. So why not PHP?
It could be very useful in an SQL query, if it doesn't return anything.
Best Regards
Pelle Ravn