- microtime: documentation ( source)
- reset: documentation ( source)
- array_shift: documentation ( source)
<?php
testShift();
testReset();
testShift();
testReset();
testShift();
testReset();
testShift();
testReset();
testShift();
testReset();
testShift();
testReset();
testShift();
testReset();
testShift();
testReset();
testShift();
testReset();
testShift();
testReset();
testShift();
testReset();
testShift();
testReset();
function testReset()
{
echo PHP_EOL;
echo PHP_EOL;
$start = microtime(true);
for ($i = 1; $i < 1000; $i++)
{
$t = [1];
reset($t);
}
echo 'reset: ' . (microtime(true) - $start);
}
function testShift()
{ echo PHP_EOL;
$start = microtime(true);
for ($i = 1; $i < 1000; $i++)
{
$t = [1];
array_shift($t);
}
echo 'shift: ' . (microtime(true) - $start);
}