note 124826 added to function.uasort
| From: | lixuss at gmail dot com | Date: | Sat, 14 Mar 2020 17:35:32 +0000 |
| Subject: | note 124826 added to function.uasort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-214332@lists.php.net to get a copy of this message | ||
Here is a bug fix for "php at clement dot hk" stable_uasort(&$array, $cmp_function)
The implementation has problems with "0" values, because while() cycle stops on current()
returning value "0" which is considered false. The condition must be !== false
Just fix those 3 lines:
while(current($array1) && current($array2)) => while(current($array1)!==false &&
current($array2)!==false)
while(current($array1)) => while(current($array1)!==false)
while(current($array2)) => while(current($array1)!==false)
----
Server IP: 45.112.84.4
Probable Submitter: 103.51.167.36 (proxied: 185.137.125.4)
----
Manual Page -- http://php.net/manual/en/function.uasort.php
Edit -- https://master.php.net/note/edit/124826
Del: integrated -- https://master.php.net/note/delete/124826/integrated
Del: useless -- https://master.php.net/note/delete/124826/useless
Del: bad code -- https://master.php.net/note/delete/124826/bad+code
Del: spam -- https://master.php.net/note/delete/124826/spam
Del: non-english -- https://master.php.net/note/delete/124826/non-english
Del: in docs -- https://master.php.net/note/delete/124826/in+docs
Del: other reasons-- https://master.php.net/note/delete/124826
Reject -- https://master.php.net/note/reject/124826
Search -- https://master.php.net/manage/user-notes.php