Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP array_product() Function

PHP array_product() Function

PHP Array ReferenceComplete PHP Array Reference Manual

Example

Calculate and return the product of an array:

Run Example »


Definition and Usage

The array_product() function calculates and returns the product of an array.


Syntax

array_product(

array

)

Parameters Description
array Required. Specifies the array.

Technical Details

Return Value: Returns the product as an integer or a float.
PHP Version: 5.1.0+
Changelog: Since PHP 5.3.6, the product of an empty array is 1. Before PHP 5.3.6, the product of an empty array was 0.

More examples

Example 1

Calculate and return the product of an array:

Run Example »


PHP Array ReferenceComplete PHP Array Reference Manual