PHP code example of glen / generator-aggregate

1. Go to this page and download the library: Download glen/generator-aggregate library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

glen / generator-aggregate example snippets




use glen\GeneratorAggregate\GeneratorAggregate;

function subgenerator()
{
    yield new ArrayIterator(['c', 'd']);
    yield 'e';
}

function generator()
{
    yield new ArrayIterator([1, 2, 3]);
    yield new ArrayIterator(['a', 'b']);
    yield subgenerator();
}

$generator = new GeneratorAggregate(generator());

print_r($generator->toArray());