RE: [PHP-DB] PHP sort from a database variable..?

From: Date: Wed, 04 Jun 2003 09:18:16 +0000
Subject: RE: [PHP-DB] PHP sort from a database variable..?
Groups: php.db 
Request: Send a blank email to php-db+get-28294@lists.php.net to get a copy of this message
> -----Original Message----- > From: heilo [mailto:grillen@abendstille.at] > Sent: 03 June 2003 23:35 > > sorry, needed some time to hack this one ::) > > as your print_r shows that you have to sort an array which > includes objects > (in this case an ingress-class - whatever this is). i tried > to simulate your > environement and endet up with this: This looks a bit like a sledgehammer to crack a nut -- why not just use usort, like this: function obj_date_compare($a, $b) { return strcmp($a->publisertLang, $b->publisertLang); } ... if($ingresser = array_merge($i1 ,$i2)) { $ingresser = usort($ingresser, 'obj_date_compare'); listIngresser($ingresser); } 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: m.ford@lmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.db (#28294) next »