Questions about php array sorting

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.