Fonction PHP array_product()
Exemple
Calcule et renvoie le produit d'un tableau :
<?php
$a=array(5,5);
echo(array_product($a));
?>
Définition et utilisation
La fonction array_product() calcule et renvoie le produit d'un tableau.
Syntaxe
array_product(array)
Valeurs des paramètres
Parameter | Description |
---|---|
array | Required. Specifies an array |
Détails techniques
Valeur de retour : | Renvoie le produit sous la forme d'un entier ou d'un flottant |
---|---|
Version PHP : | 5.1.0+ |
Journal des modifications : | Depuis PHP 5.3.6, le produit d'un tableau vide est 1. Avant PHP 5.3.6, cette fonction retournait 0 pour un tableau vide. |
Plus d'exemples
Exemple
Calcule et renvoie le produit d'un tableau :
<?php
$a=array(5,5,2,10);
echo(array_product($a));
?>
❮ Référence de tableau PHP