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

Posted by lvaro G. Vicario on 02/01/08 17:10

*** Kovu escribió/wrote (Fri, 1 Feb 2008 04:40:45 -0800 (PST)):
> Hi, I have the next problem. I want to sort the array for the key,

According to your example you want to sort an array discarding keys.
Surprisingly, the function is called "sort()". From manual:


sort - Sort an array available since: PHP 3, PHP 4, PHP 5

usage:
bool sort ( array &array [, int sort_flags] )

Note: This function assigns new keys for the elements in array . It will
remove any existing keys you may have assigned, rather than just reordering
the keys.



> using a function. I have been looking for a function to operate with
> arrays, but I haven't found anything.
>
> Ej:
>
> Array
> (
> [43] => 001480-----3-----04/11/2003
> [50] => 001000-----3-----04/11/2005
> )
>
>
> I want to convert this array to:
>
> Array
> (
> [1] => 001480-----3-----04/11/2003
> [2] => 001480-----3-----04/11/2003
> )


--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor austrohúngaro: http://www.demogracia.com
--

 

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

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