Efficiency source hard disk bad sector detection software PHP address reference PHP address reference efficiency problem

WBOY
Release: 2016-07-29 08:48:19
Original
1120 people have browsed it

Copy the code The code is as follows:


echo 'begin time:'.$begin=microtime(false).'
';//begin to count time
$ array=array();
for ($i=1;$i<=10000;$i++) {//Generate a large array
$array[$i]=$i;
}
/*
$ arr=$array;//Total copy and print time 0.02
foreach ($arr as $ar) {
echo $ar.'
';
}
*/
/*
$newarr= &$array;//The address reference time is always controlled within 0.01. The advantage of address reference is reflected
foreach ($newarr as $r) {
echo $r.'
';
}
*/
foreach ($array as $a) {//Basically 0.02, rarely 0.01 Why is it not as fast as address reference? Wondering
echo $a.'
';
}
echo 'end time:'.$end=microtime(false).'
';//end to count time
echo 'total time:'.($end-$begin);
?>

The above has introduced the efficiency issues of the PHP address reference of the efficiency source hard disk bad sector detection software, including the content of the efficiency source hard disk bad sector detection software. I hope it will be helpful to friends who are interested in PHP tutorials.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!