Re: While-else
| From: | Paul Colomiets | Date: | Sat, 12 May 2007 09:25:22 +0000 |
| Subject: | Re: While-else | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-29405@lists.php.net to get a copy of this message | ||
Pelle Ravn Rosfeldt wrote:
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.in Python else clause is executed if while is not ended by break. So it makes sense when you searching for something: <? $i = 1; while ($i <= 10) { echo $i++; if($i == $j) { echo "Found"; break; } } else { echo "Not found!"; } ?> It can't be easily written with if. But your case can be. -- Regards, Paul.