3v4l.org

run code in 500+ PHP versions simultaneously
<?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);

preferences:
85 ms | 1376 KiB | 5 Q