Re: kick-off
| From: | chagenbu at wso dot williams dot edu | Date: | Tue, 29 Feb 2000 00:11:17 +0000 |
| Subject: | Re: kick-off | ||
| References: | 1 2 3 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-25@lists.php.net to get a copy of this message | ||
Quoting Andrei Zmievski <andrei@ispi.net>:
> I think you can pass "Sort::qsort" or something similar to usort() and
> it should work.
Hmm. I tried the following without success: (no errors, no nothing - no change
in the sorted list)
<?php
error_reporting(E_ALL);
class Bar {
function cmp ($a, $b) {
if ($a == $b) return 0;
elseif ($a > $b) return 1;
else return -1;
}
}
$list = array(1, 4, 5, 2, 6, 3);
echo implode('<br>', $list);
echo '<hr>';
usort($list, 'Bar::cmp');
echo implode('<br>', $list);
?>
Anything wrong/missing here?
-chuck