Instance
Computes and returns the product of the array:
<?php$a=array (5,5); Echo (Array_product ($a));? >
Definition and usage
The array_product () function computes and returns the product of the array.
Grammar
Array_product (Array)
| Parameters |
Describe |
| Array |
Necessary. Specifies the array. |
technical details
| return value: |
Returns the product of an integer or floating-point number. |
| php version: |
5.1.0+ |
| update log: |
from PHP 5.3.6, the product of an empty array is 1. Before PHP 5.3.6, the product of an empty array was 0. |
More examples
Example 1
Computes and returns the product of the array:
<?php$a=array (5,5,2,10); Echo (Array_product ($a));? >
Example 1 (an array with a pure number without strings):
<?php$arr=array (2,3,4); Echo array_product ($arr);? >
Output results: 24
Instance (array with string):
<!doctype html>
Operation Result: