Re: the usort 's puzzle
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Sun, 30 Sep 2007 09:16:47 -0400
youngord@xxxxxxxxx wrote:
<?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???
Your com() function doesn't return a value, as required by usort(). So
results are completely unpredictable.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- the usort 's puzzle
- From: youngord
- the usort 's puzzle
- Prev by Date: ereg regexp problem
- Next by Date: Re: the usort 's puzzle
- Previous by thread: the usort 's puzzle
- Next by thread: Re: the usort 's puzzle
- Index(es):
Relevant Pages
|