对于新手来说,优化代码的习惯十分重要,

测试运行的时间,从而得出最好的一个

<?php

$t1=microtime(true);   //获取程序1,开始的时间

     程序1(代码。。。)

$t2=microtime(true);  //获取程序1,结束的时间

 

$t3=microtime(true);   //获取程序2,开始的时间

     程序1(代码。。。)

$t4=microtime(true);  //获取程序2,结束的时间

$time1=$t2-$t1;

$time2=$t4-$t3;

比较$time 和$time 从而比较两个程序的运行时间。

?>

posted on 2017-10-13 21:44  苏晨军  阅读(939)  评论(0)    收藏  举报