php 查看代码执行时间

来源:互联网 发布:免费排八字软件 编辑:程序博客网 时间:2024/05/16 20:30

时间效率对比     

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

0 0
原创粉丝点击