This question already has an answer here:
- Using function call in foreach loop 2 answers
Using the following 2 examples:
foreach($this->fooBar() as $foo => $bar) {
// do something
}
versus
$fooBar = $this->fooBar();
foreach($fooBar as $foo => $bar) {
// do something
}
Are there any implications of using either over the other or should readability be the only consideration between the two?
</div>