note 37162 added to function.usort

From: Date: Wed, 05 Nov 2003 13:12:42 +0000
Subject: note 37162 added to function.usort
Groups: php.notes 
Request: Send a blank email to php-notes+get-59937@lists.php.net to get a copy of this message
<?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 ---- Manual Page -- http://www.php.net/manual/en/function.usort.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37162 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37162&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37162&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59937) next »