You are here: Re: In memory database « PHP Programming Language « IT news, forums, messages
Re: In memory database

Posted by ImOk on 06/20/06 19:51

>
> $arr[0]=array('M',20000,20,'JOHN');
> $arr[1]=array('F',22000,24,'JANE');
> $arr[2]=array('M',32000,40,'JOE');
>
> function mySort($a1, $a2) {
> foreach($a1 as $i => $val) {
> if($a1[$i] < $a2[$i])
> return -1;
> if($a1[$i] > $a2[$i])
> return 1;
> }
> return 0;
> }
>
> usort($arr, 'mySort');
>
> Will sort it by the first "column", then the second, then the third,
> etc.

Good one. Now I have to fix it to do ascending, descending and up to 3
columns. I was trying to avoid this callback, but I may have no choice.
No one said life was easy.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация