Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$array = [
'a5' => 2,
'a6' => 3,
'a7' => 10,
'a8' => 1
];
var_export(
array_map(fn($old, $new) => $new, $array, (fn($v) => sort($v) ? $v : $v)($array))
);