$numbers = [1,2,3,4,5]; function add ($array) { return array_reduce($array, fn($acc, $val) => $acc + $val, 0); } echo add($numbers);