3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function permutation(array $arr) { while($ele=array_shift($arr)) { $x=$ele; echo $x."\n"; foreach($arr as $rest) { $x.=" $rest"; echo $x."\n"; } } } permutation( array ( '0' => 'Cardio', '1' => 'Strength Training', '2' => 'Dancing', '3' => 'Martial Arts', '4' => 'Low Impact', '5' => 'Yoga', ) );
based on RgKHu
Output for 5.6.0 - 7.3.0alpha1
Cardio Cardio Strength Training Cardio Strength Training Dancing Cardio Strength Training Dancing Martial Arts Cardio Strength Training Dancing Martial Arts Low Impact Cardio Strength Training Dancing Martial Arts Low Impact Yoga Strength Training Strength Training Dancing Strength Training Dancing Martial Arts Strength Training Dancing Martial Arts Low Impact Strength Training Dancing Martial Arts Low Impact Yoga Dancing Dancing Martial Arts Dancing Martial Arts Low Impact Dancing Martial Arts Low Impact Yoga Martial Arts Martial Arts Low Impact Martial Arts Low Impact Yoga Low Impact Low Impact Yoga Yoga