I have an array as following and I want to order that array by the value of the key \"attack\". First keys of the arrays (15, 13, 18) are ID of some certain ite
(15, 13, 18)
$result = []; foreach ($data as $key => $value) { $result[$key] = $value; asort($result[$key]); } print_r($result);
Hope this helps !!!