Sort an Array in PHP by a specific value -


how can sort this array $data['response']['games'][x]['name'] alphabetical a-z?

i have tried array_multisort() didn't understand function @ all.

hope can me - googled , searched didn't found solution problem.

edit: link updated.

code: https://github.com/gabrielwanzek/gwsteamlib/

you can achieve usort(), allows define custom comparison function:

usort($data['response']['games'], function($a, $b) {     return strcmp($a['name'], $b['name']); }); 

note $data object of type stdclass; not array.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -