PHP code example of domwebber / array-toggle-permutations

1. Go to this page and download the library: Download domwebber/array-toggle-permutations 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/ */

    

domwebber / array-toggle-permutations example snippets


use Dw\Utils\ArrayTogglePermutations;

$iterator = new ArrayTogglePermutations(
    [0,1,2]
);

// $iterator = new ArrayTogglePermutations(...);
foreach ($iterator as $permutation) {
    // Do something with the combination... For example:
    var_dump($permutation);
}

/**
 * PHP Array Permutations Iterator.
 *
 * @since 1.0.0
 * @package Dw\Utils
 * @copyright 2021 Dom Webber <[email protected]>
 * @link https://github.com/domwebber
 */