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.
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
Post a Comment