You are here: Re: [PHP] Re: sorting arrays « PHP « IT news, forums, messages
Re: [PHP] Re: sorting arrays

Posted by Brian A. Anderson on 03/09/05 01:43

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

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

 

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

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