average php function code example Example: php get array average $myArray=[1,5,4,3]; $average = array_sum($myArray)/count($myArray);