3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function createAttributeCollections($pricingAttributes = null, $permutation = array()){ //permutation result if (empty($pricingAttributes)) { return implode(',', $permutation ); //permutation } else { //permutation loop for ($i = count($pricingAttributes) - 1; $i >= 0; --$i) { $newpricingAttributes = $pricingAttributes; $newPermutations = $permutation; list($foo) = array_splice($newpricingAttributes, $i, 1); array_unshift($newPermutations, $foo); createAttributeCollections($newpricingAttributes, $newPermutations); } } } $results = createAttributeCollections(array('A','B','G','U')); foreach($results as $result){ echo $result.'<br>'; }
based on AaDeR
Output for 4.3.0 - 4.3.10, 4.4.0 - 7.2.0
Warning: Invalid argument supplied for foreach() in /in/AMaRa on line 22
Output for 4.3.11