crashmaster Posted January 4, 2008 Share Posted January 4, 2008 I have an array Array ( [35] => 4.7143 [85] => 4.4286 [17] => 4.6667 [91] => 4.5 [86] => 4.1667 [83] => 4.3333 [87] => 4.8 [93] => 5 [23] => 4.8 [22] => 5 [40] => 5 [90] => 5 [92] => 5 [55] => 4.3333 [52] => 5 [53] => 5 [56] => 5 [39] => 5 [94] => 5 [89] => 5 ) How to sort it by values ?? Not by KEY, but by VALUES. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/84468-solved-array-sort/ Share on other sites More sharing options...
Daniel0 Posted January 4, 2008 Share Posted January 4, 2008 sort() or if you wish to retain the key associations asort() Quote Link to comment https://forums.phpfreaks.com/topic/84468-solved-array-sort/#findComment-430345 Share on other sites More sharing options...
crashmaster Posted January 4, 2008 Author Share Posted January 4, 2008 I more question. what about DESC sorting ? Quote Link to comment https://forums.phpfreaks.com/topic/84468-solved-array-sort/#findComment-430347 Share on other sites More sharing options...
Daniel0 Posted January 4, 2008 Share Posted January 4, 2008 rsort() and arsort() Quote Link to comment https://forums.phpfreaks.com/topic/84468-solved-array-sort/#findComment-430349 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.