Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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);   
?>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sort #json #php
ADD COMMENT
Topic
Name
7+2 =