PHP array_product function

Last Updated: February 14, 2022

array_product – product the value of the array

Syntax

 array_product(array $array): int|float

Supports (PHP 5 >= 5.1.0, PHP 7, PHP 8)

Parameters

Parameter Description
array Required. target array

Return Value

Returns the product as an integer or float.

Example

<?php
$input = array(2, 4,6);

$result = array_product($input);


print_r($result);

?>

Output

48
Test