note 40411 deleted from control-structures.while by nlopess
| From: | nlopess@php.net | Date: | Wed, 03 Mar 2004 17:45:37 +0000 |
| Subject: | note 40411 deleted from control-structures.while by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66198@lists.php.net to get a copy of this message | ||
Note Submitter: orjansjoholm@hotmail.com
----
virtualjosh at yahoo dot com (Hosh):
Hosh wrote >>
$array = $save;
test_time("",1);
reset($array);
while ($next = next($array)) {
$key = key($array);
$array[$key] = $array[$key] * 100;
}
test_time("while (\$next = next(\$array))");
The code above leave out the first element of the array. The code below will step trough the whole
array in the same way.
$pos = reset($array);
while ($pos) {
$key = key($array);
$array[$key] = $array[$key] * 100;
$pos = next($array);
}
Regards, Örjan