Possible Duplicates:
How to sort a multi dimensional array in PHP alphabetically?
PHP : Sort array alphabetically
I am developing an API using Codeigniter and Phils RESTserver. In this API I access a database that contains users.
I would like to sort these users before outputting them. How can I do this? I tried the below code but that does not work.
function sort_by_lastname($a, $b)
{
return strcmp($a['user']['basic']['lastname'], $a['user']['basic']['lastname']);
}
This is my data in JSON format.
How can I alter the above to sort this output (when in PHP array format, not JSON).
Thankful for all help!