note 72592 rejected from function.usort by nlopess

From: Date: Thu, 25 Jan 2007 14:26:39 +0000
Subject: note 72592 rejected from function.usort by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-122190@lists.php.net to get a copy of this message
Note Submitter: tfudala at gmail dot com ---- There is error in example nr1 Should be <?php function cmp($a, $b) { if ($a == $b) { return 0; } return ($a < $b) ? -1 : 1; } $a = array(3, 2, 5, 6, 1); usort($a, "cmp"); foreach ($a as $key => $val) { echo "$key: $val\n"; } ?> Display: 0: 1 1: 2 2: 3 3: 4 4: 5

« previous php.notes (#122190) next »