[UPHPU] easy asort() question

John M johnm_ul at yahoo.com
Tue Jun 21 16:58:46 MDT 2005


I'm going through some examples on the different sort
functions and asort has me a bit confused.  It's not
sorting like I think it should be.

I've read...

http://us3.php.net/asort

...and the way I understand it is that it is supposed
to be sorted by value and not index.

The code I've typed in is sorting by index and then
value.

Here is the code I've typed in...

while (list($index,$value) = each($math))
{
  $gradestudent[] = $math[$index].$student[$index];
}
asort($gradestudent);


The result I get is...

albert einstein - Grade B
isaac newton - Grade B
simon bolivar - Grade B
ivan the terrible - Grade C
napoleon - Grade C

Is my understanding of asort wrong?  (Let me know if
you need me to post the rest of this code)


		
__________________________________ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 



More information about the UPHPU mailing list