php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41443 Wrong string sorting
Submitted: 2007-05-19 08:18 UTC Modified: 2007-05-19 17:11 UTC
From: mr at orfalis dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.2.2 OS: Windows
Private report: No CVE-ID: None
 [2007-05-19 08:18 UTC] mr at orfalis dot com
Description:
------------
The string sorting output for the next program is wrong (just for 0 case, for any other number rather than 0, it works). 

Reproduce code:
---------------
<?php

$arr_test = array();

array_push($arr_test, '0');
array_push($arr_test, '0.0');

sort($arr_test);

foreach($arr_test as $test){
  print $test . "|";
}


?>

Expected result:
----------------
0|0.0

Actual result:
--------------
0.0|0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-19 17:11 UTC] sniper@php.net
This is no bug, see manual for natsort():

http://www.php.net/natsort

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC