记录群里:


function get_microtime()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
for ($i=1;$i<=100000;$i++){
$arr[$i] = '1';
}
$start = get_microtime();
for ($i=100000;$i>=1;$i--){
$t = $arr[$i];
}
$end = get_microtime();
echo 'for:'. sprintf("%s",($end - $start));
$start = get_microtime();
foreach ($arr as $t){
$f = $arr[$t];
}
$end = get_microtime();
echo '
foreach:'.sprintf("%s",($end - $start));
?>

上一篇:
下一篇:

相关文章:

Categories: 博客记录

0 Responses so far.

Leave a Reply