X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP array_product() Function

PHP Array Reference PHP Array Reference

Example

Calculate and return the product of an array:

<?php
$a=array(5,5);
echo(array_product($a));
?>

Run example »

Definition and Usage

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


Syntax

array_product(array)

Parameter Description
array Required. Specifies an array

Technical Details

Return Value: Returns the product as an integer or float
PHP Version: 5.1.0+
Changelog: As of PHP 5.3.6, the product of an empty array is 1. Before PHP 5.3.6, this function would return 0 for an empty array.


More Examples

Example 1

Calculate and return the product of an array:

<?php
$a=array(5,5,2,10);
echo(array_product($a));
?>

Run example »


PHP Array Reference PHP Array Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook