note 100242 added to function.uksort
| From: | Yves at osu1 dot php dot net | Date: | Mon, 04 Oct 2010 06:03:25 +0000 |
| Subject: | note 100242 added to function.uksort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172923@lists.php.net to get a copy of this message | ||
Warning:
in the last version of PHP uksort() may refuse to sort the array and return false if there is a
global instruction inside the comparison function!
See http://phpquirks.blogspot.com/2010/09/globals-or-global.html
e.g.
<?php
function my_sort($a, $b)
{
global $arr;
return $arr[$a]['value'] - $arr[$b]['value'];
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 110.5.47.62
----
Manual Page -- http://www.php.net/manual/en/function.uksort.php
Edit -- https://master.php.net/note/edit/100242
Del: integrated -- https://master.php.net/note/delete/100242/integrated
Del: useless -- https://master.php.net/note/delete/100242/useless
Del: bad code -- https://master.php.net/note/delete/100242/bad+code
Del: spam -- https://master.php.net/note/delete/100242/spam
Del: non-english -- https://master.php.net/note/delete/100242/non-english
Del: in docs -- https://master.php.net/note/delete/100242/in+docs
Del: other reasons-- https://master.php.net/note/delete/100242
Reject -- https://master.php.net/note/reject/100242
Search -- https://master.php.net/manage/user-notes.php