1<?php
2usort($data, function($a, $b) { //Sort the array using a user defined function
3 return $a->score > $b->score ? -1 : 1; //Compare the scores
4});
5
6print_r($data);
7?>