$data = [3,2,8,4];
$keys = array_keys($data);
array_multisort($data, SORT_ASC, $keys);
array_walk($keys, function(&$value) { ++$value; });
var_dump($keys);
2
solved Keep order in array, but change the values [closed]
$data = [3,2,8,4];
$keys = array_keys($data);
array_multisort($data, SORT_ASC, $keys);
array_walk($keys, function(&$value) { ++$value; });
var_dump($keys);
2
solved Keep order in array, but change the values [closed]