Greetings,

////////////////// code snips starts ////////////////////////////////////
<?php
 $info = array("large", "blue", 18.00);
 sort($info);
 list($first, $second, $third) = $info;
 echo $first, "<br>";
 echo $second, "<br>";
 echo $third, "<br>";
?>
///////////////// code snips ends ////////////////////////////////////

//////////////// browser output starts/////////////////////////////////////
blue
large
18
/////////////// browser output ends ///////////////////////////////////


I can't uderstand why the number 18 is stored in the $third rather than
$first. I tried to change the 18 to "18", that is, change it from a decimal
number to a string and by that way, "18" is stored in the $first, which is
what I expected. But why doesn't 18 work?

My understanding is that the compiler checks the ascii set when it deals
with sorting. So, why the number 18 is *greater* than string "blue" and
"large" in the ascii?


cheers,

feng

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

Reply via email to