This article mainly introduces the php address reference (the efficiency issue of php address reference), which has a certain reference value. Now I share it with you. Friends in need can refer to
php address reference. To share efficiency issues, friends who are learning PHP can take a look at
<?php echo 'begin time:'.$begin=microtime(false).'<br/>';//begin to count time $array=array(); for ($i=1;$i<=10000;$i++) {//产生一个很大的数组 $array[$i]=$i; } /* $arr=$array;//拷贝 拷贝并打印总时间0.02 foreach ($arr as $ar) { echo $ar.'<br/>'; } */ /* $newarr=&$array;//地址引用 时间总是控制在0.01之内 地址引用的优势体现出来了 foreach ($newarr as $r) { echo $r.'<br/>'; } */ foreach ($array as $a) {//基本是0.02 很少是0.01 为什么没有地址引用的快呢?纳闷 echo $a.'<br/>'; } echo 'end time:'.$end=microtime(false).'<br/>';//end to count time echo 'total time:'.($end-$begin); ?>
. The above is the entire content of this article. I hope it will be helpful to everyone’s learning. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
PHP encapsulated curl calling interface and introduction to common functions
About the php htmlentities() function Definition and usage
The above is the detailed content of Regarding the efficiency issue of php address reference. For more information, please follow other related articles on the PHP Chinese website!