Question: Write PHP that calculates the average value and the maximum value for any associative array $rating that follows the following format. You may assume $ratings
Write PHP that calculates the average value and the maximum value for any associative array $rating that follows the following format. You may assume $ratings values are always non-negative. The below array has 9 values, but future examples could have more keys/values.
$rating = array(
"TPM"=>4, "AOTC"=>2, "ROTS"=>4,
"ANH"=>4, "TESB"=>5, "ROTJ"=>4,
"TFA"=>2, "TLJ"=>3, "TROS"=>1);
#your php code here
echo $average; #prints 3.2222222222222
echo " ";
echo $maxval; #prints 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
