ID:               44929
 Updated by:       [EMAIL PROTECTED]
 Reported By:      kae at verens dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: Linux
 PHP Version:      5.2.6
 New Comment:

Think if they were floats..


Previous Comments:
------------------------------------------------------------------------

[2008-05-07 15:38:51] kae at verens dot com

I'm sorry - I think I misunderstand something here.

I have just tried with the example values in 
http://sourcefrog.net/projects/natsort/example-out.txt

Expected result: no change from the input array to the outputted
array.
Actual result: the input array order is incorrect where values have a
'0' in front of them

Sample code:
<?php
$arr=array(
  '1-2', '1-02', '1-20', '10-20',
  'fred', 'jane', 'pic01', 'pic2',
  'pic02', 'pic02a', 'pic3', 'pic4',
  'pic 4 else', 'pic 5', 'pic05', 'pic 5 ',
  'pic 5 something', 'pic 6', 'pic   7', 'pic100',
  'pic100a', 'pic120', 'pic121', 'pic02000',
  'tom', 'x2-g8', 'x2-y7', 'x2-y08',
  'x8-y8'
);
natsort($arr);
var_dump($arr);

note that the values in the array there are /already sorted/ according
to natsort. With that in mind, the output should match the input.

Actual result:
array
  1 => string '1-02' (length=4)
  0 => string '1-2' (length=3)
  2 => string '1-20' (length=4)
  3 => string '10-20' (length=5)
  4 => string 'fred' (length=4)
  5 => string 'jane' (length=4)
  6 => string 'pic01' (length=5)
  8 => string 'pic02' (length=5)
  9 => string 'pic02a' (length=6)
  23 => string 'pic02000' (length=8)
  14 => string 'pic05' (length=5)
  7 => string 'pic2' (length=4)
  10 => string 'pic3' (length=4)
  11 => string 'pic4' (length=4)
  12 => string 'pic 4 else' (length=10)
  13 => string 'pic 5' (length=5)
  15 => string 'pic 5 ' (length=6)
  16 => string 'pic 5 something' (length=15)
  17 => string 'pic 6' (length=5)
  18 => string 'pic   7' (length=7)
  19 => string 'pic100' (length=6)
  20 => string 'pic100a' (length=7)
  21 => string 'pic120' (length=6)
  22 => string 'pic121' (length=6)
  24 => string 'tom' (length=3)
  25 => string 'x2-g8' (length=5)
  27 => string 'x2-y08' (length=6)
  26 => string 'x2-y7' (length=5)
  28 => string 'x8-y8' (length=5)

------------------------------------------------------------------------

[2008-05-07 15:14:44] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

See also: http://sourcefrog.net/projects/natsort/

------------------------------------------------------------------------

[2008-05-06 14:32:32] kae at verens dot com

Description:
------------
natsort, which sorts arrays using natural language, does not understand
numbers which begin with '0'.

Reproduce code:
---------------
<?php
$arr= array('test012','test01','test02');
natsort($arr);
var_dump($arr);


Expected result:
----------------
array
  1 => string 'test01' (length=6)
  2 => string 'test02' (length=6)
  0 => string 'test012' (length=7)


Actual result:
--------------
array
  1 => string 'test01' (length=6)
  0 => string 'test012' (length=7)
  2 => string 'test02' (length=6)



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44929&edit=1

Reply via email to