Re: PHP sort from a database variable..?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



wow!

thats a much more elegant way to solve this sorting problem!
didn't know usort up to now!

simple&beautiful !! :)

.ma

Ford, Mike               [LSS] <M.Ford@lmu.ac.uk> wrote@04.06.2003 11:18
Uhr:

>> -----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 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux