- array_shift: documentation ( source)
<?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',
)
);