title: Passing a function return result into a foreach loop
body: <p>Out of curiosity, are the two options below functionally equivalent?</p>
  
  <pre><code>$array_variable = function_that_creates_an_array();
  foreach($array_variable as $a){
      do_something()
  }
  </code></pre>
  
  <p>vs.</p>
  
  <pre><code>foreach(function_that_creates_an_array() as $a){
      do_something()
  }
  </code></pre>
  
  <p>Just want to make sure I'm not calling the function on every iteration or anything dumb like that.</p>
  
  <p>Thanks!</p>