- microtime: documentation ( source)
- reset: documentation ( source)
- array_slice: documentation ( source)
- array_shift: documentation ( source)
- error_reporting: documentation ( source)
- range: documentation ( source)
<?php
error_reporting(0);
$b = 1000;
$array = range(1000, 1);
$i = $b;
$s1 = microtime(true);
while($i--)
{
$a = array_shift(array_slice($array, 0, 1));
}
$s2 = microtime(true);
echo $s2 - $s1;
$s3 = microtime(true);
$i = $b;
while($i--)
{
$a = reset($array);
}
$s4 = microtime(true);
echo "\n";
echo $s4 - $s3;