Last active
August 4, 2016 17:40
-
-
Save davidChu201/fcefc4ca6de84a2b8fde692ca6ed82e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| usort() Sorts an array using a user-defined comparison function | |
| <?php | |
| function u_sort($a,$b) | |
| { | |
| if ($a==$b) return 0; | |
| return ($a < $b) ? -1 : 1; | |
| } | |
| $data=array("li"=> 3,"jim"=>5,"jack"=>10, "tom" =>"16"); | |
| uasort($data,"u_sort"); | |
| ?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment