note 37162 rejected from function.usort by didou
| From: | didou@php.net | Date: | Wed, 05 Nov 2003 13:16:20 +0000 |
| Subject: | note 37162 rejected from function.usort by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59938@lists.php.net to get a copy of this message | ||
Note Submitter: mussad@ifrance.com
----
<?php
function compare ($a, $b) {
if ($a == $b) return 0;
return ($a > $b) ? -1 : 1;
}
in that example explaining how to use the function 'usort()', this part of the code
'return ($a > $b) ? -1 : 1; ' is not correct because it must return '-1' if
'$a < $b' and but not if '$a > $b' as written.
Thank you to confirm me that.
Sincerely