<?php
$start_time = time();
$total = 0;
for($i=0;$i<1000000000;$i++){
$total +=$i;
}
$end_time = time();
var_dump("use time:".($end_time-$start_time)."s");
以上代码在php8 下面的运行时间是string(14) "use time:28s"
但在php7.4的运行时间是string(14) "use time:26s"
但在php7.3的运行时间是string(14) "use time:13s"
请问是我的php8安装有问题吗?为什么低版本的php还要快一些?
|
|