Calculate and return the product of an array:
<?php
$a=array(5,5);
echo(array_product($a));
?>
Try it Yourself »
The array_product() function calculates and returns the product of an array.
array_product(
array)
Parameter | Description |
---|---|
array | Required. Specifies 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. Before PHP 5.3.6, this function would return 0 for an empty array. |
Calculate and return the product of an array:
<?php
$a=array(5,5,2,10);
echo(array_product($a));
?>
Try it Yourself »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!