Write a PHP program to get the index of the highest value in an associative array
- برمجة بي اتش بي
- 2021-09-09
- mhanasmh00489829403
الأجوبة
<?php
$x = array(
'value1' => 3021,
'value2' => 2365,
'value3' => 5215,
'value4' => 5214,
'value5' => 2145);
reset($x); // optional.
arsort($x);
$key_of_max = key($x);
echo "Index of the highest value : ".$key_of_max."\n";
?>
Sample Output:
Index of the highest value : value3
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال