- Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.23
- Parse error: syntax error, unexpected '<' in /in/GrjM0 on line 29
Process exited with code 255.
<?php
$iter = 100000;
$array = range(0, $iter);
$function = function($val, $key) {};
$t = microtime(true);
for($i = 0; $i < $iter; $i++)
{
foreach($array as $key => $val)
{
$function($val, $key);
}
}
echo 'foreach: '.(microtime(true) - $t).'\n';
$t = microtime(true);
for($i = 0; $i < $iter; $i++)
{
array_walk($array, $function);
}
echo 'array_walk: '.(microtime(true) - $t).'\n';
$t = microtime(true);
for($i = 0; $i < $iter; $i++)
{
array_map($function, $array, array_keys($array));
}
echo 'array_map: '.(microtime(true) - $t).'\n';<?php