my task is to calculate average value from an array. 

```
$arrayToTest = [[[1], 1], [[1,3,5,7], 4], [[2,5,4,1,2,3], 2.8],
    [[-1,-1,-1,-1,-1], -1], [[4,23,84,12,76,34,-7,-23], 25.375]];

```

From inner array, so for `example [1,3,5,7]` and expected value is 4.
I have to use a function, I tried this:

```
function arrayAverage ($arrayToTest)
{
   foreach($arrayToTest as $case)
      foreach ($case as $item)
      {
         $arraySum = array_sum($item);
         $arrayCount = array_count_values($item);
         $average = $arraySum / $arrayCount;
         return $average;
      }
}

```

but it does not work. I feel I'm doing something wrong with calling the inner array.