What about php array sorting? $ Arr & nbsp; = & nbsp; array ('zhong', 'qiu', 'hangzhou', 'kuai', 'le ') I want to keep the order of the items in the array above (Happy Mid-Autumn Festival) unchanged, and all the orders that can be increased or decreased: happy Mid-Autumn Festival quick autumn festival happy questions about sorting php arrays?
$ Arr = array ('zhong', 'qiu', 'hangzhou', 'kuai', 'le ')
I want to keep the order of the items in the array above (Happy Mid-Autumn Festival) unchanged, and all the orders that can be increased or decreased:
Happy Mid-Autumn Festival
Fast Mid-Autumn Festival
Mid-Autumn Festival
Mid-Autumn Festival
Fast Autumn Festival
Autumn Festival
Jiule
Mid-Autumn Festival
Medium
Autumn
All
Thank you for your advice ~
Share:
------ Solution --------------------
$ Arr = array ('zhong', 'qiu', 'hangzhou', 'kuai', '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
Mid-Autumn Festival
Mid-Autumn Festival
Fast Mid-Autumn Festival
Zhongqiu le
Mid-Autumn Festival
Section
Moderate fast
Zhongle
Medium
Autumn
Section
Fast
Happy