Mathematical Operations on Arrays in PHP

array_sumarray_product
Задание 1

Given an array:

php<?php
  $arr = [1, 2, 3, 4, 5];
?>

Find the sum of the elements of this array.

Задание 2

Given an array:

php<?php
  $arr = [1, 2, 3, 4, 5];
?>

Find the product (multiplication) of the elements of this array.

Задание 3

Given an array:

php<?php
  $arr = [1, 2, 3, 4, 5];
?>

Using the functions array_sum and count, find the arithmetic mean of the elements (sum of elements divided by their count) of this array.