php json_encode sort code example
Example: sort json in php
<?php
usort($data, function($a, $b) { //Sort the array using a user defined function
return $a->score > $b->score ? -1 : 1; //Compare the scores
});
print_r($data);
?>