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"; Link to comment https://forums.phpfreaks.com/topic/37075-solved-quick-array-question/ 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 Link to comment https://forums.phpfreaks.com/topic/37075-solved-quick-array-question/#findComment-177070 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.