You can achieve this with usort()
, which allows you to define a custom comparison function:
usort($data['response']['games'], function($a, $b) {
return strcmp($a['name'], $b['name']);
});
Note that $data
is an object of type stdClass
; it is not an array.