note 79238 deleted from function.count by danbrown
| From: | danbrown@php.net | Date: | Fri, 09 Jan 2009 22:59:05 +0000 |
| Subject: | note 79238 deleted from function.count by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149006@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
I can confirm Wulfson's comment below. The for loop should be faster in most situations, just
as long as you're iterating through a sequentially indexed array.
In fact, from my experience using foreach to iterate through an associative array is actually slower
than using a while loop.
<?php
/* foreach iterator */
foreach($assoc_array as $key => $value) { }
/* while iterator */
while(list($key, $value) = each($assoc_array)) { }
?>