ID:               27142
 Updated by:       [EMAIL PROTECTED]
 Reported By:      tomas dot matousek at matfyz dot cz
-Status:           Open
+Status:           Bogus
 Bug Type:         Zend Engine 2 problem
 Operating System: WinXP
 PHP Version:      5.0.0b3 (beta3)
 New Comment:

See http://www.php.net/asort and notice the 2nd option for this
function. Then see http://www.php.net/sort what values it accepts. Then
try those values. Then fix your own compare function.



Previous Comments:
------------------------------------------------------------------------

[2004-02-04 06:54:13] tomas dot matousek at matfyz dot cz

Description:
------------
The way in which elements of an array are compared is inconsistent.


Reproduce code:
---------------
    $a = $c = array("101a","100","6");
    $b = $d = array("100","6","101a");

    // standard comparison:
    $f = create_function('$a,$b','return ($a<$b) ? -1:($a>$b ?
+1:0);');
    
    asort($a);
    asort($b);
    uasort($c,$f);
    uasort($d,$f);
    
    print_r($a);
    print_r($b);
    print_r($c);
    print_r($d);


Expected result:
----------------
Than I would expect all 'print_r' print arrays with the same order of
values. 
I would expect that items implicitly converted into numbers during
comparison should precede those of type string.

Actual result:
--------------
Array
(
    [2] => 6
    [1] => 100
    [0] => 101a
)
Array
(
    [2] => 101a
    [1] => 6
    [0] => 100
)
Array
(
    [2] => 6
    [1] => 100
    [0] => 101a
)
Array
(
    [2] => 101a
    [1] => 6
    [0] => 100
)



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27142&edit=1

Reply via email to