Hello,
Im working on application and im pulling data and keeping them into Array. Here is the array :
Array ( [0] => Array ( [Picscore] => 4 [Picstotalvote] => 4 [Userid] => 165703106 [PicID] => 3155771420245492384 ) [1] => Array ( [Picscore] => 4 [Picstotalvote] => 4 [Userid] => 165703106 [PicID] => 3155771420245492385 ) [2] => Array ( [Picscore] => 7.3333333333333 [Picstotalvote] => 3 [Userid] => 165703106 [PicID] => 711689421146404998 ) [3] => Array ( [Picscore] => 9.5 [Picstotalvote] => 2 [Userid] => 165703106 [PicID] => 711689421146322449 ) [4] => Array ( [Picscore] => 6 [Picstotalvote] => 2 [Userid] => 165703106 [PicID] => 2609110194718361717 ) [5] => Array ( [Picscore] => 8 [Picstotalvote] => 2 [Userid] => 165703106 [PicID] => 711689421146274711 ) [6] => Array ( [Picscore] => [Picstotalvote] => 0 [Userid] => 165703106 [PicID] => 711689421146337639 ) [7] => Array ( [Picscore] => [Picstotalvote] => 0 [Userid] => 165703106 [PicID] => 711689421146219965 ) [8] => Array ( [Picscore] => 4 [Picstotalvote] => 4 [Userid] => 165703106 [PicID] => 3155771420245492384 ) )
Everything is good so far. but i would like to sort it by 'Picscore' . I tried sort() , asort() and arsort(); but non of them worked. What can i do?
Thanks
Musti
Sorting Array on PHP
Moderator: General Moderators
Re: Sorting Array on PHP
If you write a function that can sort two items (in the array) then you can use usort.