PHP的一些 有用但不常用的函数记录

时间:2014-07-10 10:28:36   收藏:0   阅读:245

1. microtime()

  当前 Unix 时间戳以及微秒数。

 <?php

$mem = new Memcache;

$mem->connect("127.0.0.1", 11211);

$time_start = microtime_float();

//保存数据

for($i = 0; $i < 100000; $i ++){

    $mem->set("key$i",$i,0,3);

}

$time_end = microtime_float();

$run_time = $time_end - $time_start;

echo "用时 $run_time 秒\n";

function microtime_float()

{

    list($usec, $sec) = explode(" ", microtime());

    return ((float)$usec + (float)$sec);

}

?>

 

PHP的一些 有用但不常用的函数记录,布布扣,bubuko.com

评论(0)
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!