Question

I have this array:

Array
(
    [0] => 0px 0px
    [1] => -101px 0px
    [2] => -205px -3px
    [3] => 0px -77px
    [4] => -100px -80px
    [5] => -202px -80px
)

I would like to sort it in order to have:

Array
    (
        [0] => -202px -80px
        [1] => -100px -80px
        [2] =>  0px -77px
        [3] => -205px -3px
        [4] => -101px 0px
        [5] => 0px 0px
    )

Based on my research, the ksort() is supposed to do the trick but Im having 1.

Could someone please tell me what I am doing wrong. Thanks

Was it helpful?

Solution

Use array_reverse(): http://php.net/array_reverse

It reverses the array order as the name suggests.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top