Generator Return Expression in PHP7

PHP 7 allows us to include a return statement within a generator function in order to enable for a final expression to be returned. This final expression can be fetched by calling the getReturn() function on the generator object. We can call the getReturn() function when the generator finished yielding its values only.
Back to Top