$arr = Array (' Medium ', ' fall ', ' knots ', ' fast ', ' le ')
I want to achieve the above in this array of items (happy Mid-Autumn Festival) before and after the order unchanged, you can add or subtract all sorts:
Happy Mid-Autumn Festival
Fast Mid-Autumn Festival
Festival Music
Mid - autumn festival
Autumn Festival Fast
Autumn Festival
Festival Music
Mid - autumn festival
In
Autumn
Like this all the
Please give us a lot of advice thank you ~
Reply to discussion (solution)
$arr = Array (' Medium ', ' fall ', ' knots ', ' fast ', ' Le '); for ($i =0; $i <=count ($arr); $i + +) { $a = join (", Array_slice ($arr, 0,-$i));
if ($i) foreach (Array_slice ($arr,-$i) as $v) echo $a. $v, Php_eol; else echo $a, php_eol;}
Happy Mid-Autumn Festival
Fast Mid-Autumn Festival
Festival Music
Mid - autumn festival
Fast Mid-Autumn
Mid-Autumn Music
Mid - autumn festival
Middle section
Medium and fast
Zhong Le
In
Autumn
Section
Fast
Le
$arr = Array (' Medium ', ' fall ', ' knots ', ' fast ', ' Le '); for ($i =0; $i <=count ($arr); $i + +) { $a = join (", Array_slice ($arr, 0,-$i));
if ($i) foreach (Array_slice ($arr,-$i) as $v) echo $a. $v, Php_eol; else echo $a, php_eol;}
Happy Mid-Autumn Festival
Fast Mid-Autumn Festival
Festival Music
Mid - autumn festival
Fast Mid-Autumn
Mid-Autumn Music
Mid - autumn festival
Middle section
Medium and fast
Zhong Le
In
Autumn
Section
Fast
Le
Thank you very much for the help of the moderator hahaha ~