<?php
$data = array(
"1"=>array(
"id"=>1,
"name"=>"Test #1",
"listorder"=>1),
"6"=>array(
"id"=>6,
"name"=>"Test #1",
"listorder"=>3),
"2"=>array(
"id"=>2,
"name"=>"Test #2",
"listorder"=>2)
);
uasort($data,function($a,$b){
return strcmp($a["listorder"],$b["listorder"]);
});
print_r($data);
- Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- Array
(
[1] => Array
(
[id] => 1
[name] => Test #1
[listorder] => 1
)
[2] => Array
(
[id] => 2
[name] => Test #2
[listorder] => 2
)
[6] => Array
(
[id] => 6
[name] => Test #1
[listorder] => 3
)
)
preferences:
249.1 ms | 404 KiB | 335 Q