Reply to Re: Sorting string-array without case...

Your name:

Reply:


Posted by jodleren on 11/11/32 12:00

On Jan 16, 6:49 pm, ZeldorBlat <zeldorb...@gmail.com> wrote:
> On Jan 16, 10:40 am, jodleren <sonn...@hot.ee> wrote:
>
>
>
>
>
> > Hi!
>
> > I user sort() but it gives me all uppercase items first.
> > Looking athttp://ee.php.net/manual/en/function.sort.phpIcannot find
> > what I need - tried natcasesort, but that was even more
> > interesting....
>
> How about this (untested):
>
> $arr = array('foo', 'bar', 'Baz');
> usort($arr, create_function('$v1,$v2', 'return strcasecmp($v1,
> $v2);'));- Hide quoted text -
>
Yep, that does it. Thanks

I implemented it as this, which makes it work as a normal sort.

function my_sort(&$arr)
{
usort($arr, create_function('$v1,$v2', 'return
strcasecmp($v1,$v2);'));
}

[Back to original 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

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