note 79238 added to function.count

From: Date: Fri, 16 Nov 2007 16:31:58 +0000
Subject: note 79238 added to function.count
Groups: php.notes 
Request: Send a blank email to php-notes+get-132355@lists.php.net to get a copy of this message
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)) { } ?> ---- Server IP: 209.41.74.194 Probable Submitter: 69.48.114.91 ---- Manual Page -- http://www.php.net/manual/en/function.count.php Edit -- https://master.php.net/note/edit/79238 Del: integrated -- https://master.php.net/note/delete/79238/integrated Del: useless -- https://master.php.net/note/delete/79238/useless Del: bad code -- https://master.php.net/note/delete/79238/bad+code Del: spam -- https://master.php.net/note/delete/79238/spam Del: non-english -- https://master.php.net/note/delete/79238/non-english Del: in docs -- https://master.php.net/note/delete/79238/in+docs Del: other reasons-- https://master.php.net/note/delete/79238 Reject -- https://master.php.net/note/reject/79238 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132355) next »