I try to sort a multidimensional array in the way, so that the elements with the same value should not being reordered.
This is the given array, which should be sorted by the value of type
:
$arr = array(
"a" => array(
"type" => 1
),
"d" => array(
"type" => 1
),
"super" => array(
"type" => 2
),
"c" => array(
"type" => 1
),
"b" => array(
"type" => 1
)
);
The sorted array should be look like this:
Array
(
[super] => Array
(
[type] => 2
)
[a] => Array
(
[type] => 1
)
[d] => Array
(
[type] => 1
)
[c] => Array
(
[type] => 1
)
[b] => Array
(
[type] => 1
)
)