Re: the usort 's puzzle



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
==================
.



Relevant Pages

  • Re: Getting ID from a presented table
    ... Jerry Stuckle ... JDS Computer Training Corp. ... PHP echo statement instead. ... I do not know how to do that in HTML. ...
    (comp.lang.php)
  • Re: Getting ID from a presented table
    ... Jerry Stuckle ... JDS Computer Training Corp. ... Same idea - just generated with a PHP echo statement instead. ... I do not know how to do that in HTML. ...
    (comp.lang.php)
  • Re: Getting ID from a presented table
    ... Jerry Stuckle ... JDS Computer Training Corp. ... PHP echo statement instead. ... I do not know how to do that in HTML. ...
    (comp.lang.php)
  • Re: Getting ID from a presented table
    ... Jerry Stuckle ... JDS Computer Training Corp. ... Same idea - just generated with a PHP echo statement instead. ... I do not know how to do that in HTML. ...
    (comp.lang.php)
  • Re: Getting ID from a presented table
    ... Jerry Stuckle ... JDS Computer Training Corp. ... echo statement instead. ... I do not know how to do that in HTML. ...
    (comp.lang.php)