PHP Need to recursively reverse an array

后端 未结 3 581
遇见更好的自我
遇见更好的自我 2021-01-21 12:57

I need to recursively reverse a HUGE array that has many levels of sub arrays, and I need to preserve all of the keys (which some are int keys, and some are string keys), can so

3条回答
  •  生来不讨喜
    2021-01-21 13:49

    Recursively:

    
    

    output:

    Array
    (
        [0] => 1
        [1] => 3
        [2] => 5
        [3] => 7
        [4] => 9
    )
    Array
    (
        [0] => 9
        [1] => 7
        [2] => 5
        [3] => 3
        [4] => 1
    )
    

提交回复
热议问题