导读
上一篇文章提到count — Count all elements in an array, or something in an object,但是还有一个sizeof(),它是count的别名,为何会有一个别名出现呢?不会是写这个函数的人偏好C,而用了sizeof吧,决定一探究竟。
说明
以下测试将分作两个版本,一是一般数组大小 10000 个元素,二是大数组 100000 个元素,并且只采用cli方式执行。
详细
A 10000
<?php
echo 'Using for loop of sizeof(), the upper limit is 10,000. Do pre_calc or not, here are the performance differents >> ---- ';
$x = array_fill(0,......
阅读全文