PHP Aligning Array Key Values

前端 未结 3 1069
春和景丽
春和景丽 2021-01-16 20:53

I\'ve Googled it for two days, and tried looking at the PHP manual, and I still can\'t remember that function that aligns the key values for PHP arrays.

All I\'m loo

3条回答
  •  清酒与你
    2021-01-16 21:28

    Well, you see, this one is hard, because the general description on the PHP array functions page does not say that this function does what you're looking for.

    But you can sort the array using ksort(), and then use this: array_values() . From the page from the PHP manual:

    array_values() returns all the values from the input array and indexes numerically the array.

提交回复
热议问题