array_multisort(array_values($array), SORT_DESC, array_keys($array), SORT_ASC, $array);
Here is the code you are looking for.
<?php
$array = array(5=>100,4=>100,3=>100,1=>100,8=>97,6=>97,9=>82,7=>80);
$keys = array_keys($array);
$values = array_values($array);
sort($keys);
rsort($values);
for($i=0;$i<=count($keys)-1;$i++){
$array[$keys[$i]] = $values[$i];
}
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.