<?php $data = json_decode('{ "result": true, "users": [{ "id": 11, "expected_count": 13, "user_id": 1, "event_id": 2, "user": { "id": 1, "name": "Moiz Jamali" } }, { "id": 12, "expected_count": 12, "user_id": 2, "event_id": 2, "user": { "id": 2, "name": "Juzer Samiwala" } }] }'); function cmp($a, $b) { if ($a->user->name == $b->user->name) { return 0; } return ($a->user->name < $b->user->name) ? -1 : 1; } usort($data->users, "cmp"); print_r($data);
You have javascript disabled. You will not be able to edit any code.