Bug #17307 Updated: sorting using usort() does not produce correct result anymore

From: Date: Wed, 22 May 2002 12:44:49 +0000
Subject: Bug #17307 Updated: sorting using usort() does not produce correct result anymore
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-8213@lists.php.net to get a copy of this message
ID: 17307 Updated by: fcartegnie@nordnet.fr Reported By: fcartegnie@nordnet.fr Status: Feedback Bug Type: Arrays related Operating System: Linux PHP Version: 4.2.1 New Comment: Related to Bug #17307 Previous Comments: ------------------------------------------------------------------------ [2002-05-18 08:49:39] derick@php.net Please prive a short self containing script (which runs right away after copy&paste). Derick ------------------------------------------------------------------------ [2002-05-18 08:36:08] fcartegnie@nordnet.fr I used to make sorts with usort and calling the function below. This was working on the last versions but not anymore on the 4.2.1 :/ which outputs strange result. function sort_function($a, $b) { if ((($a["livre"]/$a["quantite"]) == ($b["livre"]/$b["quantite"])) || $a["nom"] != $b["nom"]) return 0; return (($a["livre"]/$a["quantite"]) < ($b["livre"]/$b["quantite"])) ? -1 : 1; } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17307&edit=1

« previous php.bugs (#8213) next »