title: Is PHP capable of caching count call inside loop?
body: <p>I know the more efficient way to have a loop over array is a foreach, or to store count in a variable to avoid to call it multiple times.
  But I am curious if PHP have some kind of "caching" stuff like:</p>
  
  <pre><code>for ($i=0; $i&lt;count($myarray); $i++) { /* ... */ }
  </code></pre>
  
  <p>Does it have something similar and I am missing it, or it does not have anything and you should code:</p>
  
  <pre><code>$count=count($myarray);
  for ($i=0; $i&lt;$count; $i++) { /* ... */ }
  </code></pre>