array_product in PHP

Syntax of array_product

number array_product(array array)

Returns the product of every element in array. If each value in array is an integer, the resulting product is an integer; otherwise, the resulting product is a float

Example of array_product

<?php

$a = array(2, 4, 6, 8);
echo "product(a) = " . array_product($a) . "\n";
echo "product(array()) = " . array_product(array()) . "\n";

?>
product(a) = 384
product(array()) = 1

Leave a Comment