PHP array_product() Function
Instance
Calculate and return the product of the array:
<?php $a=array(5,5); echo(array_product($a)); ?>
Definition and Usage
The array_product() function calculates and returns the product of the array.
Syntax
array_product(array)
Parameter | Description |
---|---|
array | Required. Specify the array. |
Technical Details
Return Value: | Return the product of integers or floating-point numbers. |
PHP Version: | 5.1.0+ |
Update Log: | Starting from PHP 5.3.6, the product of an empty array is 1. Before PHP 5.3.6, the product of an empty array is 0. |
More Examples
Example 1
Calculate and return the product of the array:
<?php $a=array(5,5,2,10); echo(array_product($a)); ?>