Reverse an associative array with preserving keys in PHP
use array_reverse().
array array_reverse ( array $array [, bool $preserve_keys = false ] )
Takes an input array and returns a new array with the order of the elements reversed.
Note: make sure you read the documentation about the 2nd argument of said function.
What about the reverse function array_reverse ?
$reversed = array_reverse($array, true);
Doc: http://php.net/manual/en/function.array-reverse.php