tmh766 Posted February 4, 2007 Share Posted February 4, 2007 If you have a multi array such as: $myArray = array(); #For example prices. $myArray[0][0] = 68.4; $myArray[0][1] = 100.2; $myArray[0][2] = 34.2; #For example name. $myArray[1][0] = "Orange"; $myArray[1][1] = "Lemon"; $myArray[1][2] = "HotPocket"; how do you implement sort() to put the array in decending price order while keeping the name with the price to look like this: #For example sorted prices. $myArray[0][0] = 100.2; $myArray[0][1] = 68.4; $myArray[0][2] = 34.2; #For example name. $myArray[1][0] = "Lemon"; $myArray[1][1] = "Orange"; $myArray[1][2] = "HotPocket"; Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 4, 2007 Share Posted February 4, 2007 http://us2.php.net/manual/en/function.array-multisort.php There's an example that explains: Example 242. Sorting multi-dimensional array Quote Link to comment 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.