php 查看代码执行时间,
时间效率对比
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<?php function getmicrotime() { list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } // 记录开始时间 $time_start = getmicrotime(); // 这里放要执行的PHP代码,如: // echo create_password(6); // 记录结束时间 $time_end = getmicrotime(); $time = $time_end - $time_start; // 输出运行总时间 echo "执行时间 $time seconds"; ?> |
转载于:http://www.ludou.org/how-to-create-a-password-generator-using-php.html
PHP之友评论