note 79582 deleted from function.count by felipe

From: Date: Sun, 16 Dec 2007 01:27:08 +0000
Subject: note 79582 deleted from function.count by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-133614@lists.php.net to get a copy of this message
Note Submitter: djcassis at gmail dot com ---- If, like Anonymous, you are interested in the performances of loops in PHP, please check this very useful benchmark link : http://www.php.lt/benchmark/phpbench.php Results may surprise you. For the associative array $a containing 100 elements, it seems this is the fastest way : <?php $k = array_keys($a); $v = array_values($a); $c = count($k); for ($i = 0; $i < $c; ++$i) { // do stuff with $k[$i] and $v[$i] } ?> Cheers

« previous php.notes (#133614) next »