Bug #1371: handling of each() over empty lists
| From: | nathanh at chirp dot com dot au | Date: | Mon, 03 May 1999 01:22:57 +0000 |
| Subject: | Bug #1371: handling of each() over empty lists | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-5349@lists.php.net to get a copy of this message | ||
From: nathanh@chirp.com.au
Operating system: Linux
PHP version: 3.0.7
PHP Bug Type: Feature/Change Request
Bug description: handling of each() over empty lists
The following code snippet generates a nasty warning when $mylist is empty.
while (list($key, $val) = each($mylist)) {
// do warning
}
The workaround in PHP is trivial, but ugly.
while (count($mylist) and list($key, $val) = each($mylist)) {
// do warning
}
Would be nicer if the each() iterator just returned nothing, causing the while loop to terminate,
when the list is empty.
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net