PHP code example of glagola / cross-product-iterator

1. Go to this page and download the library: Download glagola/cross-product-iterator 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/ */

    

glagola / cross-product-iterator example snippets




use Glagola\CrossProductIterator;

function aa() {
    yield 'x1';
    yield 'x2';
    yield 'x3';
}

$iterator = new CrossProductIterator([
    aa(),
    new ArrayIterator(['y1']),
    new ArrayIterator(['z1', 'z2', 'z3']),
    new ArrayIterator(['f1', 'f2', 'f3']),
]);

foreach ($iterator as $items) {
    echo "['", implode("', '", $items), "']", PHP_EOL;
}