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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mr at orfalis dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Apr 19 14:01:30 2024 UTC