Tamam, bu yüzden gitti ve o ölçülür -
Test This And This And, uh, This
--------------------------- ---------------------------- ----------------------------
Setup Setup Setup
---------------------------- ---------------------------- ----------------------------
$i = array_fill(0,1000,'1'); $j = array_fill(0,1000,'1'); $j = array_fill(0,1000,'1');
$c = 0; $d = 0; $e = 0;
--------------------------- ---------------------------- ---------------------------
Code Under Test Code Under Test Code Under Test
--------------------------- ------------------------------ --------------------------
foreach ($i as $v) foreach (array_keys($j) as $k) foreach ($i as &$v)
{ $c+= $v; } { $d+= $j[$k]; } { $e+= $v; }
--------------------------- ------------------------------ -------------------------
Tear Down Tear Down Tear Down
--------------------------- ----------------------------- -------------------------
print "c = $c"; print "d = $d"; print "e = $e";
---------------------------- ----------------------------- --------------------------
Test for repetitions. 10000
---------------------------- ----------------------------- -------------------------
c = 10000000 d = 10000000 e = 10000000
---------------------------- ----------------------------- -------------------------
Ran in 1.8540189266205 Ran in 4.0039160251617 Ran in 1.9633851051331
--------------------------- ----------------------------- -------------------------
Winner -0.10936617851257 Looser 2.0405309200287 2nd Best 0
--------------------------- ---------------------------- -------------------------
Foreach (v $ olarak $ a) benziyor dizini 'keys'e çok daha iyi olduğunu ve bu kullanarak ve v ortasında.