[UPHPU] easy asort() question

John M johnm_ul at yahoo.com
Wed Jun 22 11:28:43 MDT 2005


Thank you, Thank you everyone.

My purpose wasn't to change how it was echo'd (sorted)
in exam2.php.  I was just trying to understand why it
was sorting the way it was...first by index and then
by value.  I now understand that (or at least I think
I do)...

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

...passed $gradestudent to...

asort($gradestudent);

...with the grade first, sorted the array, and then
the rest of the example code...

while (list($index,$value) = each($gradestudent))
{
  echo "<br>$student[$index] - $math[$index]";
}

...reversed the two so-to-speak when it echo'd it to
the screen (browser).  I don't know why I didn't see
that before.

Anyway, thanks again for the help.  The example code
posted taught me about the usage of print_r which I
haven't seen yet in the tutorials I have been going over.


		
____________________________________________________ 
Yahoo! Sports 
Rekindle the Rivalries. Sign up for Fantasy Football 
http://football.fantasysports.yahoo.com



More information about the UPHPU mailing list