How to use array product in PHP

In this article, I will explain how the array_product() function can be used in PHP.
  • 1519

array_product() function in PHP

  • The array_product() function calculates product of an array.

  • The array_product() function returns the product of values in an array as an integer or float.

Syntax

array_product(array)

Parameter

  • array  array is required parameter. Specifies an array.

Example

The following example show to how the array_product() function can be used in PHP.

<html>

<body>

<h3 style="color: red;">array_product() function example in PHP</h3>  

    <?php

    $a1=array(5,5,5);

    echo("Product is : ");

    print_r(array_product($a1));

    ?> 

</body>

</html>

 

Output

product.jpg
You may also want to read these related articles here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.