Site icon NgDeveloper

array_product in php example

It calculates the product of all the array values.

Syntax:

array_product($array);

Program:

<?php
$number=array(10,20,5);
print_r($number);
$total=array_product($number); 
//array_product() calculates the product values for $number array values.
echo "product of given array  is\t";
print_r($total);
?>

 

Output:

 

 

 

Thanks for reading this post…………..!!!

Exit mobile version