PHP array_product() Function

t returns the product of values in an array as an integer or float.

The array_product() function calculates and returns the product of an array.

As of PHP 5.3.6, the product of an empty array is 1. Before PHP 5.3.6, this function would return 0 for an empty array.

ParameterDescription
arrayRequired. Specifies an array

Syntax

 array_product(array) 

Example

$array=array(3,3,2,10);
echo(array_product($array));

Output

180

Leave a Reply

Your email address will not be published. Required fields are marked *