note 74940 deleted from control-structures.break by peehaa
| From: | peehaa@php.net | Date: | Wed, 22 Feb 2017 09:36:21 +0000 |
| Subject: | note 74940 deleted from control-structures.break by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208795@lists.php.net to get a copy of this message | ||
Note Submitter: vinyanov at poczta dot onet dot pl
----
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();
?>