PHP array foreach $ key ranking

Source: Internet
Author: User
{Code ...} above, I would like to ask if $ key is shaved to be removed, and the sorting is still normal. Example 1, James 2, Tom 3, Tom 4, and Tom red are normal sorting, but I want to shave off the data of the name and the data will become 1, James 3, Tom 4, and so on, but what I want is...
Foreach ($ abc as $ key => $ val) {Here we sort by $ key, but there are several people with the $ val condition in the middle who want to shave from the ranking}

Above, I would like to ask $ key if it is shaved to be removed, it will still be sorted normally

For example

1, Xiao Ming 2, Xiao Bai 3, Xiao Hei 4, Xiao Hong

This is a normal sorting, but I want to shave off the data with name =, and then it will become

1, Xiao Ming 3, Xiao Hei 4, Xiao Hong

But what I want is

1, Xiao Ming 2, Xiao Hei 3, Xiao Hong

Sort normally after Removal

The problem has been disabled. cause:

Reply content:
Foreach ($ abc as $ key => $ val) {Here we sort by $ key, but there are several people with the $ val condition in the middle who want to shave from the ranking}

Above, I would like to ask $ key if it is shaved to be removed, it will still be sorted normally

For example

1, Xiao Ming 2, Xiao Bai 3, Xiao Hei 4, Xiao Hong

This is a normal sorting, but I want to shave off the data with name =, and then it will become

1, Xiao Ming 3, Xiao Hei 4, Xiao Hong

But what I want is

1, Xiao Ming 2, Xiao Hei 3, Xiao Hong

Sort normally after Removal


  

I don't know if LZ needs this effect?

Write a program to remove the person to be removed. Write a program to sort the program. That is to say, You need to divide the work into two steps.

array_splice

Do you know this function?

Http://www.php.net/manual/en/function.array-splice.php

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.