#44929 [Opn->Bgs]: natsort and natcasesort fail if numbers in strings prepended by 0

From: Date: Wed, 07 May 2008 15:14:47 +0000
Subject: #44929 [Opn->Bgs]: natsort and natcasesort fail if numbers in strings prepended by 0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-124801@lists.php.net to get a copy of this message
ID: 44929 Updated by: jani@php.net 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: 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/ Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#124801) next »