Skip to content

Instantly share code, notes, and snippets.

@nook24
Last active March 23, 2017 07:50
Show Gist options
  • Save nook24/8a0ee7c8007ce554b7b59d9550e28f1d to your computer and use it in GitHub Desktop.
Save nook24/8a0ee7c8007ce554b7b59d9550e28f1d to your computer and use it in GitHub Desktop.
<?php
$a = [
1 => ['' => 'Foobar'],
2 => ['Bar'],
3 => ['Foo']
];
$assertedOutput = [
0 => ['Foo'],
1 => ['Bar'],
2 => ['' => 'Foobar']
];
rsort($a);
print_r($a);
?>
/****** PHP 5.5.9-1ubuntu4.21 *******/
Array
(
[0] => Array
(
[0] => Foo
)
[1] => Array
(
[0] => Bar
)
[2] => Array
(
[] => Foobar
)
)
/****** PHP 7.0.15-0ubuntu0.16.04.4 *******/
Array
(
[0] => Array
(
[] => Foobar
)
[1] => Array
(
[0] => Foo
)
[2] => Array
(
[0] => Bar
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment