欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

计算时间差 微秒 有大用

shiping1 的头像
<?php

/*
 * Created on 2016-4-2
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
echo "下面是microtime里的参数为空<br />";
$start = microtime();
echo $start . "开始";
echo "<br />";

$start = explode(' ', $start);
echo "执行各种代码......";


echo "<br />";
$end = microtime();
echo $end . "开始";
;
echo "<br />";
$end = explode(' ', $end);

$total = $end[0] + trim($end[1]) - $start[0] - trim($start[1]);
echo "时间差" . $total;
echo "<br />";

echo "下面是microtime里的参数为true<br />";

$start = microtime(true);
echo $start. "开始";;
echo "<br />";

echo "执行各种代码......";

echo "<br />";
$end = microtime(true);
echo $end. "结束";
echo "<br />";
echo $end - $start;
echo "<br />";
?>

普通分类: