PHP code example of anarchitecture / combinatorics
1. Go to this page and download the library: Download anarchitecture/combinatorics 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/ */
anarchitecture / combinatorics example snippets
use Anarchitecture\combinatorics as c;
use Anarchitecture\pipe as p;
$items = ['a' => 1, 'b' => 2];
$subsets = $items
|> c\iterable_powerset()
|> p\collect(...)
// [
// [],
// ['a'=>1],
// ['b'=>2],
// ['a'=>1,'b'=>2]
// ]