From:             [EMAIL PROTECTED]
Operating system: Linux + Windows
PHP version:      4CVS-2002-10-10
PHP Bug Type:     Arrays related
Bug description:  sorting a String case-sensitive fails

I tried the following script to sort an Array case-sensitive:


<?php
$test = array("B",
              "a",
              "b",
              "A",
              "BB",
              "AA");
usort($test, 'strcasecmp');
print_r($test);
?>

What I expected to get was:

Array
(
    [0] => A
    [1] => a
    [2] => AA
    [3] => B
    [4] => b
    [5] => BB
)

What I got on Win2000/PHP 4.2.4-dev was:

Array
(
    [0] => A
    [1] => a
    [2] => AA
    [3] => b
    [4] => B
    [5] => BB
)

and using Linux with PHP 4.1.2 I got

Array
(
    [0] => a
    [1] => A
    [2] => AA
    [3] => B
    [4] => b
    [5] => BB
)

both is not correct. 


regards 

Andreas

-- 
Edit bug report at http://bugs.php.net/?id=19850&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=19850&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=19850&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=19850&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=19850&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=19850&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=19850&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=19850&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=19850&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=19850&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=19850&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=19850&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=19850&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=19850&r=isapi

Reply via email to