note 61555 deleted from function.next by bjori
| From: | bjori@php.net | Date: | Thu, 27 Apr 2006 09:59:55 +0000 |
| Subject: | note 61555 deleted from function.next by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-109845@lists.php.net to get a copy of this message | ||
Note Submitter: php_comments at munkyboy dot com
----
be careful when using the return value of 'next()' in a while or do-while loop. The
following loop will exit before it can go through all elements of the array...
<?
$testArray = array(
"a" => "apple",
"b" => false,
"c" => "cat"
);
do {
echo(key($testArray)."\n");
} while (next($testArray));
?>