I want to create a directory class, and I want it to function as an iterator (foreach-able). But I want it to be generator based (for example a function that does "yield"). Is it possible?
Take the 2-minute tour
×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
There is not an interface explicitly for classes to implement generators, but you can make use of See this example of implementing
|
|||||
|
Generators are Iterators. From http://www.php.net/manual/en/language.generators.object.php
|
|||||||||||||
|