Bug #67831 [Opn->Fbk]: Wrong sorting array

From: Date: Wed, 13 Aug 2014 07:41:19 +0000
Subject: Bug #67831 [Opn->Fbk]: Wrong sorting array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187097@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67831&edit=1 ID: 67831 Updated by: fa@php.net Reported by: fotlax at qip dot ru Summary: Wrong sorting array -Status: Open +Status: Feedback Type: Bug Package: Arrays related PHP Version: 5.6.0RC3 Block user comment: N Private report: N New Comment: Could you please elaborate on your - Operating sustem - configure line - actual output because on my 5.6.0RC3 on Ubuntu 12.04 I get exactly your expected result. Should you be talking about the leading zeroes, the natsort() manual page says: 5.2.10 Zero padded numeric strings (e.g., '00005') now essentially ignore the 0 padding. and SORT_NATURAL references natsort() Previous Comments: ------------------------------------------------------------------------ [2014-08-12 16:54:17] fotlax at qip dot ru Description: ------------ Wrong sorting Array when sort_flags = SORT_NATURAL. Test script: --------------- $a=['W1010','W108','W109','W1011']; $b=['W0010','W008','W009','W0011']; sort($a,SORT_NATURAL); sort($b,SORT_NATURAL); print_r($a); # Sort OK print_r($b); # Sort Wrong - Why? Bug? Expected result: ---------------- Array ( [0] => W108 [1] => W109 [2] => W1010 [3] => W1011 ) Array ( [0] => W0010 [1] => W0011 [2] => W008 [3] => W009 ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67831&edit=1

« previous php.bugs (#187097) next »