Copy CodeThe code is as follows:
Echo ' Begin time: '. $begin =microtime (false). '
';//begin to count time
$array =array ();
for ($i =1; $i <=10000; $i + +) {//produce a very Large array
$array [$i]= $i;
}
/*
$arr = $array;//copy copy and print total time 0.02
foreach ($arr as $ar) {
echo $ar. '
';
}
*/
/*
$newarr =& $array;//Address reference time is always controlled within 0.01 the advantages of address references are reflected
foreach ($newarr as $r) {
echo $r. '
';
}
*/
foreach ($array as $a) {//Basic is 0.02 is rarely 0.01 why is there no address reference fast? Wonder
echo $a. '
';
}
Echo ' End time: '. $end =microtime (false). '
';//end to count time
Echo ' Total time: '. ($end-$begin);
?>
http://www.bkjia.com/PHPjc/325221.html www.bkjia.com true http://www.bkjia.com/PHPjc/325221.html techarticle Copy the code as follows:? PHP echo ' Begin time: '. $begin =microtime (false). ' br/';//begin to Count Time $array =array (); for ($i =1; $i =10000; $i + +) {//produce a large array $arra ...