- var_dump: documentation ( source)
- range: documentation ( source)
<?php
class Foo {
public function test() {
return $this->getGenerator(range(0, 10));
}
public function getGenerator(array $items) {
foreach ($items as $item) {
yield $item;
}
}
}
$f = new Foo;
foreach ($f->test() as $item) {
var_dump($item);
}