Array
(
[SECTIONS] => Array
(
[19] => Array
(
[ID] => 19
)
[20] => Array
(
[ID] => 20
)
[21] => Array
(
[ID] => 21
)
)
[ELEMENTS] => Array
(
[19] => Array
(
[ID] => 19
[NAME] => QWe
[VALUE] => FEf
[URL] => efwfw
)
[13] => Array
(
[ID] => 13
[NAME] => sdfsd
[VALUE] => FsdfggEf
[URL] => ee
)
[25] => Array
(
[ID] => 25
[NAME] => Treg
[VALUE] => Grge
[URL] => Effee
)
)
)
Array
(
[SECTIONS] => Array
(
[19] => Array
(
[ID] => 19
)
[20] => Array
(
[ID] => 20
)
[21] => Array
(
[ID] => 21
)
)
[ELEMENTS] => Array
(
[13] => Array
(
[ID] => 13
[NAME] => sdfsd
[VALUE] => FsdfggEf
[URL] => ee
)
[19] => Array
(
[ID] => 19
[NAME] => QWe
[VALUE] => FEf
[URL] => efwfw
)
[25] => Array
(
[ID] => 25
[NAME] => Treg
[VALUE] => Grge
[URL] => Effee
)
)
)
$keys = array_keys($arr["ELEMENTS"]);
sort($keys);
$arr["ELEMENTS"] = array_map(function ($val) {
return [
$val => [
"ID" => $val
]
];
}, $keys);