加班的时候突然想到两种写法的效率问题,遂写下这玩意:require("global.php");$time = getMicrotime();
for($c=0; $c<10000000; $c++)
{
if($c == 11111)
{
1+1;
continue;
}
1+1;
}
echo getMicrotime()-$time."<br>";$time = getMicrotime();
for($c=0; $c<10000000; $c++)
{
if($c==11111) 1+1;
else 1+1;
}
echo getMicrotime()-$time;测试结果:3.61796998978
3.758246898653.30234384537
3.50695085526
for($c=0; $c<10000000; $c++)
{
if($c == 11111)
{
1+1;
continue;
}
1+1;
}
echo getMicrotime()-$time."<br>";$time = getMicrotime();
for($c=0; $c<10000000; $c++)
{
if($c==11111) 1+1;
else 1+1;
}
echo getMicrotime()-$time;测试结果:3.61796998978
3.758246898653.30234384537
3.50695085526
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货