数组重新排序保持当前值在同一索引中

时间:2018-03-07 07:31:41

标签: php arrays

我有一个数组 -

Array
    (
        [1] => 10890.000
        [2] => 3751.000
        [0] => 0
        [3] => 0
        [4] => 0
        [5] => 0
        [6] => 0
        [7] => 0
    )

如何重新排序,保持当前值在同一索引下。例如以下 -

Array
(
    [0] => 0
    [1] => 10890.000
    [2] => 3751.000
    [3] => 0
    [4] => 0
    [5] => 0
    [6] => 0
    [7] => 0
)

我已经尝试过array_values()但它没有返回预期的输出

0 个答案:

没有答案