PHP

PHP Menu

PHP

array_product() Function - Definition, Syntax, Parameters, Examples

Definition

The array_product() function calculates the product of the values in an array.

Syntax

array_product(array)

Parameters

Parameter Description
array Required. Specifies the array to work on.

Example

<?php
// Example 1 $x = array(2,3); echo(array_product($x)); echo "<br>";
// Example 2 $y = array(2, 3, 4, 5); echo(array_product($y)); echo "<br>";
// Example 3 $z = array(2, 3, "four", 5); echo(array_product($z)); echo "<br>";

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods