fork download
  1. <?php
  2.  
  3.  
  4. $rates = array(2,2,3,8,3,5,1,7,3,6,2,5,7,3);
  5.  
  6. $rates_sum = array_sum($rates);
  7. $rates_count = count($rates);
  8. $avg_rate = round($rates_sum / $rates_count);
  9.  
  10. echo "There was total {$rates_count} points, their sum is {$rates_sum}\nAverage rating is {$avg_rate}";
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
There was total 14 points, their sum is 57
Average rating is 4