php函数microtime

来源:互联网 发布:淘宝溢价是什么意思 编辑:程序博客网 时间:2024/05/21 06:30

microtime()

<?php    echo microtime();?>
结果

       0.45007200 1488294332  第一个微秒数,第二个时间戳

explode(separator,string)---将字符串打散为数组

      separator----规定在哪里分割字符串

      string----要分割的字符串

<?php    $arr= explode(' ',microtime());    $result=$arr[0]+$arr[1];    echo $result;?>

结果

       1488295502.6371

利用microtime()测程序运行的时间

<?php    $arr= explode(' ',microtime());    $start=$arr[0]+$arr[1];?> //添加一些程序 <?php    $arr= explode(' ',microtime());    $end=$arr[0]+$arr[1];?>

结果

      2.288818359375E-5

round(num,n)-----将num保留n为小数

<?php    echo round($end-$start,4);?>


0 0