<?php
//開始計時
$HeaderTime = microtime(true);//參數(shù)true表示返回浮點數(shù)值
//代碼
//...
printf(" total run: %.2f s<br>".
"memory usage: %.2f M<br> ",
microtime(true)-$HeaderTime,
memory_get_usage() / 1024 / 1024 );
?>
結果:
total runtime: 1.47 s
memory usage: 77.09 M
]]>