I'm genuinely curious... is the impact on performance remotely concerning when using count($arr)
over and over in a loop, vs. storing the count first, and then iterating?
In other words, does this:
$count = count($arr);
for($i = 0; $i < $count; $i++) { ... }
Perform any better than this:
for($i = 0; $i < count($arr); $i++) { ... }
I have never noticed a performance issue, but my arrays are usually relatively small (maybe a few hundred items at most). But for very large arrays, does it make a difference whether you store the count before iterating or re-calculate the count every time the loop runs?