2021-04-23

PHP 调试程序运行时间实例

function microtime_float()
{
     list($usec, $sec) = explode(" ", microtime());
     return ((float)$usec + (float)$sec);
}

$time_start = microtime_float();

// Sleep for a while
//usleep(100);

for($i=0;$i<100000;$i++){
	$arr[$i] = $i;
}
$cc = sizeof($arr);

$time_end = microtime_float();
$time = $time_end - $time_start;

echo '<br/>'.$cc . "<br/>Did nothing in $time seconds<br/><br/>";

发表回复

Your email address will not be published. Required fields are marked *