PHP array_product() Function
In this chapter you will learn:
- Definition for PHP array_product() Function
- Syntax for PHP array_product() Function
- Parameter for PHP array_product() Function
- Example - Calculate and return the product of an array
Definition
The array_product() function calculates the product of an array.
Syntax
PHP array_product() Function has the following syntax.
array_product(array)
Parameter
- array - Required. Array to calculate
Example
Calculate and return the product of an array:
<?php/*from j a v a 2 s.c o m*/
$a=array(5,5);
print_r($a);
echo(array_product($a));
echo "\n";
$a=array(5,5,2,10);
print_r($a);
echo(array_product($a));
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Syntax for PHP array_push() function
- Definition for PHP array_push() function
- Parameter for PHP array_push() function
- Note for PHP array_push() function
- Note 2 for PHP array_push() function
- Example - Push element to an array
- Example - Push more than one value to an array
Home » PHP Tutorial » PHP Array Functions