> -----Original Message----- > From: Mark Cubitt [mailto:[EMAIL PROTECTED]] > Sent: 19 February 2003 12:43 > > I need to manipulate, the following data in a number of > diffierent ways > > I'm storing the data in a multidemensional array, the > stucture of which > is below, and I need to sort it by "Total Time On Phone" in decending > order, which is the first element of the 'embedded' array.
> //just filled with some descriptive default values > $extensionsDetails = array('Total Time On Phone', 'Total Number of > calls', 'name of person'); > > // a hash of extention numbers and the $extensionsDetails > array (above) > $telData = array( > // management > '2000' => $extensionsDetails, > '2001' => $extensionsDetails, Use usort() with a callback that compares the 'Total Time On Phone' elements. Something like: function compTime($a, $b) { return $a[0]==$b[0]?0:($a[0]>$b[0]?1:-1); } usort($telData, 'compTime'); Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php