Last active
December 12, 2015 06:59
-
-
Save hugollm/4733267 to your computer and use it in GitHub Desktop.
php wtf ~ php's (regular) sorting algorithm is totally unpredictable with mixed types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$array1 = array("a","b","4",5,4,"true","TRUE",true, false, "c", "d"); | |
$array2 = array("a","b","4",5,4,"true","TRUE",true, false, "c"); | |
sort($array1); | |
sort($array2); | |
dump($array1); | |
dump($array2); | |
function dump($var) | |
{ | |
echo '<pre><code>'; | |
var_dump($var); | |
echo '</code></pre>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment