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