- var_dump: documentation ( source)
<?php
function xrange($start, $limit, $step = 1) {
for ($i = $start; $i <= $limit; $i += $step) {
yield $i;
}
}
$generator = xrange(1, 100);
var_dump($generator);
while ($generator->valid()) {
print $generator->current() . PHP_EOL;
$generator->next();
}