PHP array_product () function
Examples
Computes and returns the product of the array:
<?php
$a=array(5,5);
echo(array_product($a));
?>
$a=array(5,5);
echo(array_product($a));
?>
Running instance »
Definition and Usage
array_product () function calculates and returns the product array.
grammar
array_product( array )
参数 | 描述 |
---|---|
array | 必需。规定数组。 |
technical details
return value: | It returns an integer or floating-point product. |
---|---|
PHP version: | 5.1.0+ |
Update log: | Since PHP 5.3.6 onwards, the product is an empty array. Prior to PHP 5.3.6, the product of an empty array is zero. |
More examples
Example 1
Computes and returns the product of the array:
<?php
$a=array(5,5,2,10);
echo(array_product($a));
?>
$a=array(5,5,2,10);
echo(array_product($a));
?>
Running instance »
Complete PHP Array Reference