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?
->fooBarin your first example and->fooin your second, but that's probably unintentional.foreach(($fooBar = $this->fooBar()) as $foo => $bar) {$fooBarafter the loop. There's perl for that >;-)