You are here: Re: Sort array without index « PHP Programming Language « IT news, forums, messages
Re: Sort array without index

Posted by christiang on 02/07/06 11:49

Hi Erwin, I tried in many ways, using also usort but it doesn't work.
This is my last test:

- iniside the method of the class -
usort($arr, array ($this,"cmp"));

function cmp($a, $b)
{
if ($a['relationCount_int'] == $b['relationCount_int']) {
return 0;
}
return ($a['relationCount_int'] > $b['relationCount_int']) ? -1 : 1;
}

debugging it is comparing the right values, but the order doesn't
change. Could be the fact that the array has as index a string instead
of number? Cheers, chr

 

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

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