PHP array_product() Function
Definition
The array_product() function calculates the product of an array.
Syntax
PHP array_product() Function has the following syntax.
array_product(array)
Parameter
- array - Required. Array to calculate
Example
Calculate and return the product of an array:
<?php/* ww w . j a v a 2 s .c o m*/
$a=array(5,5);
print_r($a);
echo(array_product($a));
echo "\n";
$a=array(5,5,2,10);
print_r($a);
echo(array_product($a));
?>
The code above generates the following result.