usort function...
| From: | Fernando da Motta Hildebrand | Date: | Mon, 16 Oct 2000 00:41:45 +0000 |
| Subject: | usort function... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-20287@lists.php.net to get a copy of this message | ||
When you pass a function to usort:
function len ( $a,$b) {
$la = strlen ($a);
$lb= strlen ($b);
if ($la == $lb ) return 0;
return ($la < $lb ) ? -1 : 1 ;
}
$co = array ("aaaa" , "aa" , "aaa" );
usort ( $co, len);
how does usort take a two parameter function ( $a,$b) and knows how to
use it with a array as big as anyother, with any kind of values? How does it
compares it? two by two? Can i always use two parameters functions for
usort?
Thanks!!!