PHP code example of patchranger / cartesian-iterator

1. Go to this page and download the library: Download patchranger/cartesian-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/ */

    

patchranger / cartesian-iterator example snippets




use PatchRanger\CartesianIterator;

r();
// The second argument controls the key of the corresponding value in the product array.
$cartesianIterator->attachIterator(new ArrayIterator([1,2]), 'test');
// No second argument means incremental numeration (indexed).
$cartesianIterator->attachIterator(new ArrayIterator(['foo', 'bar']));

$result = iterator_to_array($cartesianIterator, false);
print_r($result);