Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

array_product

Description

The array_product of Array for PHP calculate the product of values in an array.

Syntax

array_product(
    array $array
): int|float

Parameters

array

The array.

Return

Returns the product as an integer or float.

Examples

1 · array · int

<?

$array = [2, 3];

$return = array_product($array);

var_dump($return);

?>
int(6)

2 · array · float

<?

$array = [2.5, 3];

$return = array_product($array);

var_dump($return);

?>
float(7.5)

3 · array · empty

<?

$array = [];

$return = array_product($array);

var_dump($return);

?>
int(1)
HomeMenu