- var_dump: documentation ( source)
- mt_rand: documentation ( source)
<?php
function test($reset = FALSE) {
static $i;
if ($reset) {
unset($i);
return;
}
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);
test(TRUE);
$rappels = array();
while($row = test()) {
$rappels[] = $val;
}
var_dump($rappels);