Bug #12848 Updated: asort-SORT_NUMERIC inconsistent with non numeric values
| From: | developer at i-space dot org | Date: | Sun, 28 Apr 2002 12:03:53 +0000 |
| Subject: | Bug #12848 Updated: asort-SORT_NUMERIC inconsistent with non numeric values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-6345@lists.php.net to get a copy of this message | ||
ID: 12848
Updated by: developer@i-space.org
Reported By: kzi@gmx.net
Status: Closed
Bug Type: Arrays related
Operating System: win98
PHP Version: 4.0.6
New Comment:
i have the same problem :
using 6 array : $years, $months, $ids, $titles, $urls, $dates
and doing :
$ar = array($years, $months, $ids, $titles, $urls, $dts);
array_multisort($ar[0], SORT_DESC, SORT_NUMERIC, $ar[1], SORT_NUMERIC,
SORT_DESC, $ar[2], $ar[3], $ar[4], $ar[5]);
which results "Warning: Array sizes are inconsistent in ...". even with
SORT_REGULAR it gives the same error. but it sorts them which is pretty
funny :)
i suppress it with @ and it sorts them without showing warnings - the
only way it works
p.s. it shwo that warning from time to time - not always.
Previous Comments:
------------------------------------------------------------------------
[2001-10-21 01:51:13] sniper@php.net
Can not reproduce with PHP 4.1.0RC1.
--Jani
------------------------------------------------------------------------
[2001-08-19 18:57:49] kzi@gmx.net
If asort() is used with the sort flag SORT_NUMERIC and the values ar
non numeric, the sort order of those values should remain unchanged in
principle. But in arrays with few of such non numeric items (app. <
10), the first item is generally moved to the bottom, while in arrays
with more items, one element from somewhere in the middle is moved to
the top.
example:
$q =
array(1=>'A',2=>'B',3=>'C',4=>'D',5=>'E');
asort($q,SORT_NUMERIC);
produces the value sequence B,C,D,E,A
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=12848&edit=1