TLK: Sort behaviour
John Coggeshall wrote in to say that
<?php
$a = array('a', 'b', 'c', 'a'=>0, 'b'=>1, 'c'=>2);
sort($a);
print_r($a);
?>
gives unexpected results, and forgot to attach a patch that would alter this behaviour. Marcus Börger agreed, but pointed out that there were two possible versions of 'expected behaviour', both equally valid. He mailed in a patch for one of those versions. Andi responded that he was concerned the 'fix', whichever direction it took, might break backward compatibility and also affect other functionality, as it actually involves altering the Zend engine's comparison operators. The patch is on hold pending further investigation into these possibilities – or we could just accept that this is how PHP's sort() behaves, and fall back on alternative functions or user-space workarounds to deal with the fact, as of yore.
Marcus went on looking into sort(), and subsequently committed a patch that gives the function a 15% performance increase, while supposedly listening to an OSCON talk about performance. This was one among many performance patches committed during the week, primarily by Marcus and Andi.
Short version: sort() still gives strange results, but now it gives them faster.
J'aime l'humour de la version courte :)
Source : http://www.zend.com/zend/week/week195.php