The array_product Function

The array_product function calculates the product (multiplication) of array elements.

Syntax

phparray_product(array $array): int|float

Example

Let's find the product of array elements:

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

Code execution result:

php120

See Also

  • the array_sum function,
    which finds the sum of array elements