- microtime: documentation ( source)
- range: documentation ( source)
<?php
$arr = range(0, 10000);
$start_time = microtime(true);
for ($index = 0; $index < 100000; $index++)
{
count($arr);
}
echo 'Took: ' . (string) (microtime(true) - $start_time) . "\n";
$start_time = microtime(true);
for ($index = 0; $index < 100000; $index++)
{
empty($arr);
}
echo 'Took: ' . (string) (microtime(true) - $start_time) . "\n";