Menu Home

array_product

osbo.com | PHP | Functions | array_product

Calculate the product of values in an array

Syntax

array_product ( array $array ) : number

Parameters

array

The array.

Return

Returns the product as an integer or float.

Examples

array

<?

$array = array(2, 4);

$return = array_product($array);

echo $return;

?>
8

Empty

<?

$array = array();

$return = array_product($array);

echo $return;

?>
1

PHP