PHP array_product() Function

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/*  ww w .  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.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions