Sort array with multiple keys

Posted by Vincent on Stack Overflow See other posts from Stack Overflow or by Vincent
Published on 2010-04-22T20:51:44Z Indexed on 2010/04/22 20:53 UTC
Read the original article Hit count: 261

Filed under:

All,

I have the following array in array format. The JSON format is shown just for user-friendliness. How can I sort the array ascending with the key "name" in php?

            "food":
            [
                {
                    "id": 1,
                    "name": "dessert"
                },
                {
                    "id": 2,
                    "name": "maincourse"
                },
                {
                    "id": 3,
                    "name": "entrees"
                },
                {
                    "id": 4,
                    "name": "appetizers"
                }
            ]

© Stack Overflow or respective owner

Related posts about php5