note 119216 added to function.usort

From: Date: Wed, 20 Apr 2016 15:39:31 +0000
Subject: note 119216 added to function.usort
Groups: php.notes 
Request: Send a blank email to php-notes+get-205289@lists.php.net to get a copy of this message
it seems the sorting function doesn't have to return either 0, 1, and -1. It will treat any positive number at 1 and any negative number as -1. So you won't need to write if else statements you can just return one value minus the other one. ---- Server IP: 72.52.91.14 Probable Submitter: 212.219.153.191 ---- Manual Page -- http://php.net/manual/en/function.usort.php Edit -- https://master.php.net/note/edit/119216 Del: integrated -- https://master.php.net/note/delete/119216/integrated Del: useless -- https://master.php.net/note/delete/119216/useless Del: bad code -- https://master.php.net/note/delete/119216/bad+code Del: spam -- https://master.php.net/note/delete/119216/spam Del: non-english -- https://master.php.net/note/delete/119216/non-english Del: in docs -- https://master.php.net/note/delete/119216/in+docs Del: other reasons-- https://master.php.net/note/delete/119216 Reject -- https://master.php.net/note/reject/119216 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#205289) next »