Re: Re: sorting arrays

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

 



Brian A. Anderson wrote:
RTFM
arsort()


Ok, so I use asort(), and I don't get the result I wanted. Instead I get the
script telling me my foreach loop is wrong on the second test round, as if
it did something other than simply sort the array. It seems that I can't
access the array now?



$nar = array('lma-bg51' => 1, 'mcr-vh14' => 2, 'gmc-rr21' => 5, 'amh-fg23'
=> 1);

foreach( $nar AS $key => $val ) {
 echo "$key: $val<br />";
}

$nar = asort($nar);
    ^--- WTF is the name of this var?


foreach( $nar2 AS $key => $val ) {
    	     ^--- WTF is the name of this var?

 echo "$key: $val<br />";
}


-- 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