<?php
$stratTime = microtime(true);
$startMemory = memory_get_usage();
$a = 1;
for($i = 1; $i <= 100000; $i++){
$a++;
}
echo $a;
$endTime = microtime(true);
$runtime = ($endTime - $stratTime) * 1000; //将时间转换为毫秒
$endMemory = memory_get_usage();
$usedMemory = ($endMemory - $startMemory) / 1024;
echo "运行时间: {$runtime} 毫秒<br />";
echo "耗费内存: {$usedMemory} K";