140 of 410 menu

The array_product Function

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

Syntax

array_product(array $array): int|float

Example

Let's find the product of array elements:

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

Code execution result:

120

See Also

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