- microtime: documentation ( source)
<?php
$time = microtime(true);
for ($i = 0; $i <= 10000000; $i++) {
chr(0);
}
$time2 = microtime(true);
echo $time2 - $time;
echo "\r\n";
class FOO {
const BAR = '';
public function stats() {
$time = microtime(true);
for ($i = 0; $i <= 10000000; $i++) {
self::BAR;
}
$time2 = microtime(true);
echo $time2 - $time;
}
}
$foo = new FOO();
$foo->stats();
This script was stopped while abusing our resources