You are here: Re: the usort 's puzzle « All PHP « IT news, forums, messages
Re: the usort 's puzzle

Posted by Jerry Stuckle on 09/30/07 13:16

youngord@gmail.com 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@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация