note 111965 added to function.ksort
| From: | stephen | Date: | Wed, 17 Apr 2013 17:11:02 +0000 |
| Subject: | note 111965 added to function.ksort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194523@lists.php.net to get a copy of this message | ||
ksort and krsort fail to undestand scientific notation, https://bugs.php.net/bug.php?id=43053, therefore
when sorting numeric keys, if the key is of the form 0.00001 php will represent it as 1.0E-5.
These methods will assume this to be a string and therefore not organise your array as you may
expect.
When using value of this form for array keys use sprintf('%f', 0.00001) to generate the
key, for smaller values the precision needs to be included
e.g. sprintf('%0.10f', 0.00000001)
----
Server IP: 87.124.126.49
Probable Submitter: 82.136.45.164
----
Manual Page -- http://php.net/manual/en/function.ksort.php
Edit -- https://master.php.net/note/edit/111965
Del: integrated -- https://master.php.net/note/delete/111965/integrated
Del: useless -- https://master.php.net/note/delete/111965/useless
Del: bad code -- https://master.php.net/note/delete/111965/bad+code
Del: spam -- https://master.php.net/note/delete/111965/spam
Del: non-english -- https://master.php.net/note/delete/111965/non-english
Del: in docs -- https://master.php.net/note/delete/111965/in+docs
Del: other reasons-- https://master.php.net/note/delete/111965
Reject -- https://master.php.net/note/reject/111965
Search -- https://master.php.net/manage/user-notes.php