Recycle Generator

../_images/recycle_generator.png

After creating a generator, it is possible to nest it and run the same geenrator twice. It is the role of the functioncall $g(), which actually creates the data source for the loop. Hence, here, the generator is always fresh at the start of the nested loop.

It would be possible to create the datasource before the loop and nest it, though it breaks at the second loop.

See Also

PHP Error Messages

PHP Features