<?php $arr = [ 65 => [ ["p" => 234, "sp" => 234], ["p" => 53, "sp" => 5], ["p" => 530, "sp" => 5], ] ]; $col = 'p'; // set the column you want to order on $column = array_column($arr[65], $col); // get all p values asort($column); // sort values ascending but keep keys $arr[65] = $arr[65][array_key_first($column)]; // replace key "65" array by array-value with key containing lowest "p" var_dump($arr);
You have javascript disabled. You will not be able to edit any code.