Compute and return the product of the values in an array.
<?php $a=array(5,5); echo(array_product($a)); ?> |
The array_product() function computes and returns the product of all the elements in an array.
array_product(array) |
Parameter |
Description |
array |
Required. Provides an array. |
Return Value: |
Returns the product as an integer or float. |
PHP Version: |
5.1.0+ |
Changelog: |
As of PHP 5.3.6, the product of an empty array is 1. Prior to PHP 5.3.6, this function returned 0 for an empty array. |
Compute and return the product of the elements in an array.
<?php $a=array(5,5,2,10); echo(array_product($a)); ?> |