- var_dump: documentation ( source)
- mt_rand: documentation ( source)
<?php
function test() {
static $i;
if (!isset($i))
$i = 3;
if ($i <= 0)
return;
$i--;
return array('id' => mt_rand(), 'iteration' => $i);
}
$rappels = array();
$i = 0;
while($row = test()) {
foreach($row as $key=>$val) {
$rappels[$i][$key] = $val;
}
$i++;
}
var_dump($rappels);
$rappels = array();
while($row = test()) {
$rappels[] = $val;
}
var_dump($rappels);