Skip to content

Instantly share code, notes, and snippets.

@mimming
Last active August 29, 2015 14:11
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mimming/62389513a85e4abdc913 to your computer and use it in GitHub Desktop.
PHP wat
$foo = array(-1, NULL, 0, NULL, 0, NULL, -1);
echo "unsorted\n";
print_r($foo);
sort($foo);
echo "sorted once\n";
print_r($foo);
sort($foo);
echo "sorted twice\n";
print_r($foo);
unsorted
Array
(
[0] => -1
[1] =>
[2] => 0
[3] =>
[4] => 0
[5] =>
[6] => -1
)
sorted once
Array
(
[0] =>
[1] => 0
[2] =>
[3] => -1
[4] => -1
[5] => 0
[6] =>
)
sorted twice
Array
(
[0] =>
[1] =>
[2] =>
[3] => -1
[4] => -1
[5] => 0
[6] => 0
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment