RE: resetting arrays

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

 



> -----Original Message-----
> From: I. Gray [mailto:phpsupport@xxxxxxxxxxxxxxxxxxxx]
> Sent: Tuesday, June 21, 2005 2:34 PM
> To: php-general@xxxxxxxxxxxxx
> Subject:  resetting arrays
> 
> Hi.
> 
> I am sure this is easy, but I can't get this work.  Is there not a php
> function that can do this?

Yes, use sort()
 
> I have an array- for example...
> [1] => Yellow
> [2] => Green
> [3] => Purple
> [4] => Blue
> [5] => Red
> [6] => Orange
> [7] => Cyan

This does however set yellow to 0, not 1 - run through the array with
foreach:

foreach($array AS $key => $val) {
  $count++;
  $new_array[$count] = $val";
}

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/Systemdeveloper

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux