Re: the usort 's puzzle
- From: "Shelly" <sheldonlg.news@xxxxxxxxxxxxxxxx>
- Date: Sun, 30 Sep 2007 06:30:56 -0400
<youngord@xxxxxxxxx> wrote in message
news:1191123436.050247.225700@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
<?php
$mix=array(
array("A",10),
array("B",5),
array("C",100)
);
function com($x,$y){
echo $x[0];
}
usort($mix,'com');
?>
i think the $x[0] result is A,
but the final $x[0] result is BC.
why???
From www.php.net:The comparison function must return an integer less than, equal to, or
greater than zero if the first argument is considered to be respectively
less than, equal to, or greater than the second.
So, what does "com" return?
Shelly
.
- References:
- the usort 's puzzle
- From: youngord
- the usort 's puzzle
- Prev by Date: Re: Namespaces? Why?
- Next by Date: Re: Table schema for user login system?
- Previous by thread: Re: the usort 's puzzle
- Next by thread: Re: the usort 's puzzle
- Index(es):