Does using a function in foreach loop caches the result, or calls the function each time?
<p>In the following code:</p>

<pre><code>function a(){
    echo 'a';
    return array(1,2,3,4);
}

foreach(a() as $t){
    echo $t; 
}
</code></pre>

<p>We can see a() is called only once, and it seems the returned value is cached...<br>
But then I got to see <a href="http://stackoverflow.com/questions/1013493/coalesce-function-for-php">this debate (see comments on the question)</a> am I missing something?</p>
