Question:
There is an array a = array (there are many elements here). Pass through the array with the for (i=0; i<=count(a); i++) loop for (i=0; i<=count(a); i++) . Is it possible to speed up the cycle somehow?
Answer:
1) Move count (a) to a separate variable.
2) Read the array from the end as a for (i=count(a); i>=0; i--) loop for (i=count(a); i>=0; i--)
- It seems to me or in the error condition and at
<=count (greater or equal) the loop will run forever? - Why if running along the array from the end will be faster?
foreach ($arr as $v) {...}- tutankhamun