What are the new features of the generator in PHP7
This article mainly introduces what are the new features of the generator in PHP7. It is very detailed and has a certain reference value. Friends who are interested must read it!
A New feature of Generator in PHP7 yield-from & & return-values
Generator delegation
Simply translate the description of the official document:
In PHP7, other generators, iteratable objects, and arrays can be delegated to the outer generator through the generator yield from. The outer generator first orders the values delegated by yield, and then continues the values defined in the yield itself.
Using yield from makes it easier for us to write nesting generators that are relatively clear, and code nesting calls are necessary for writing complex systems.
The above example is: