Re: Sorting Bug / Wrong behavior?

From: Date: Wed, 28 Jul 2004 06:19:06 +0000
Subject: Re: Sorting Bug / Wrong behavior?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-11588@lists.php.net to get a copy of this message
This isn't a bug. All those strings evaluate to 0. You should use a sort() function which is suitable. At 02:48 PM 7/27/2004 -0500, John Coggeshall wrote:
Consider the following: <?php $a = array('a', 'b', 'c', 'a'=>0, 'b'=>1, 'c'=>2);
      sort($a);
      print_r($a);
?> This produces a bogus output: Array (
    [0] => a
    [1] => b
    [2] => 0
    [3] => c
    [4] => 1
    [5] => 2
) Notice how 0 and c are switched incorrectly. Attached is a patch to zend_operators.c that fixes it. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.internals (#11588) next »