mardi 4 août 2015

PHP sort an associative array

I have an array like this. I need to sort countries (array key) by [0][amount] value.

Array
(
    [Germany] => Array
        (
            [0] => Array
                (
                    [amount] => 50
                    [count] => 1
                )

        )

    [Poland] => Array
        (

            [0] => Array
                (
                    [amount] => 80
                    [count] => 2
                )

        )

)

Result should be Poland first and Germany. Any idea in PHP?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire