3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { static $i; if (!isset($i)) $i = 3; if ($i <= 0) return; return array('id' => $i--, 'someValue' => mt_rand()); } $rappels = array(); $i = 0; while($row = test()) { foreach($row as $key=>$val) { $rappels[$i][$key] = $val; } $i++; } var_dump($rappels);

preferences:
28.93 ms | 402 KiB | 5 Q