<?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); }
You have javascript disabled. You will not be able to edit any code.