- microtime: documentation ( source)
- array_filter: documentation ( source)
- number_format: documentation ( source)
- md5: documentation ( source)
<?php
$i=0; $j=500000;
while($i < 60000) {
$i++; $j++;
$data1[] = md5($i);
$data2[] = md5($j);
}
$time = microtime(true);
echo "Starting array_filter\n";
$x = 0;
$test = array_filter($data1, function($str) use (&$x) {
return ++$x % 2 != 0;
});
$test = array_filter($data2, function($str) use (&$x) {
return ++$x % 2 != 0;
});
unset($test);
$time = microtime(true) - $time;
echo 'array_filter() took ' . number_format($time, 3) . " seconds\n";