note 12246 deleted from control-structures.while by sobak
| From: | sobak@php.net | Date: | Thu, 01 Dec 2016 17:15:31 +0000 |
| Subject: | note 12246 deleted from control-structures.while by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207866@lists.php.net to get a copy of this message | ||
Note Submitter: yohgaki at hotmail dot com
----
If you want to traverse array, foreach() is faster than while() a little.
[Benched with PHP4.0.4pl1/Apache DSO/Linux]
i.e.
foreach ($array as $k => $v)
is a little faster than
while (list($k,$v) = each($array))
You might want to use foreach for large arrays.