Copy the Code code 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);
?>
The above describes the efficiency source hard drive bad detection software PHP address reference PHP address reference efficiency issues, including the efficiency of the source hard drive bad detection software content, I hope that the PHP tutorial interested friends helpful.