note 74940 added to control-structures.break
| From: | vinyanov at poczta dot onet dot pl | Date: | Sat, 05 May 2007 12:36:14 +0000 |
| Subject: | note 74940 added to control-structures.break | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126212@lists.php.net to get a copy of this message | ||
Note that the break argument accepts any expression, including a function result. So you may want to
dynamically choose the loop level to break from:
<?php
// the print() function returns 1
function icarus()
{
while(print('sea level, '))
while(print('through the clouds, '))
while(print('close the Sun - '))
break rand(print('FEATHERS LOSS! - '), 3);
print('no feathers remaining.');
}
icarus();
?>
----
Server IP: 195.136.184.34
Probable Submitter: 83.31.239.118
----
Manual Page -- http://www.php.net/manual/en/control-structures.break.php
Edit -- https://master.php.net/note/edit/74940
Del: integrated -- https://master.php.net/note/delete/74940/integrated
Del: useless -- https://master.php.net/note/delete/74940/useless
Del: bad code -- https://master.php.net/note/delete/74940/bad+code
Del: spam -- https://master.php.net/note/delete/74940/spam
Del: non-english -- https://master.php.net/note/delete/74940/non-english
Del: in docs -- https://master.php.net/note/delete/74940/in+docs
Del: other reasons-- https://master.php.net/note/delete/74940
Reject -- https://master.php.net/note/reject/74940
Search -- https://master.php.net/manage/user-notes.php