This is json data in webservice, I need to sort this kind of information by top to date sort 2017..bla - 2015..bla -2014, maybe sort value "4" or title 2015 blabla.... value in a PHP script, how can I do?
"2015-09-11 09:18:11.023151": {
"1": "4422",
"2": "asd",
"3": "aaa",
"4": "2015-09-11 09:18:11.023151"
},
"2014-10-29 13:33:14.325827": {
"1": "5852",
"2": "shfe",
"3": "sds",
"4": "2014-10-29 13:33:14.325827"
},
"2017-11-10 09:18:11.315102": {
"1": "2323",
"2": "sfd",
"3": "sdf",
"4": "2017-11-10 09:18:11.315102"
}
i try :
$example= json_decode($result, true);
usort($example, function($a, $b) {
return $a->{"4"} > $b->{"4"} ? -1 : 1; });
echo json_encode($example);
how we can do it ?