a::average($array, $decimals = 0)

Returns the average value of an array

  • $array (array)
    The source array
  • $decimals (int)
    The number of decimals to return
  • return (int)
    The average value

Example

<?php
$array = [2.54, 3.98, 12.99, 15.00];

echo a::average($array);

Output:

8.75

Is something missing or incorrect? Edit this page on Github…