Performance difference between directly running a foreach() loop on a function call versus a variable holding the function result
23:56 14 Feb 2011

I was wondering if using

foreach(get_some_array() as $boo) do_something...

is slower than

$arr = get_some_array();
foreach($arr as $boo) do_something...

I mean would get_some_array() be called like 10000000 times if the array would have so many elements (in the 1st example) ?

php arrays foreach