Bonjour,
J'ai un tableau multidimentionnel comme ceci :
Code :
- $_SESSION['facture'][$n]['prix_ht_tot'] = $vte_ht * $qte;
|
et qui donne :
array(2) {
[1]=>
array(6) {
["qte"]=>
string(1) "2"
["nom_vin"]=>
string(19) "clos du bord de mer"
["annee"]=>
string(4) "2000"
["prix_ht"]=>
float(12.8)
["prix_ht_tot"]=>
float(25.6)
["date"]=>
string(10) "2007-04-22"
}
[2]=>
array(6) {
["qte"]=>
string(1) "2"
["nom_vin"]=>
string(14) "chateau Filhot"
["annee"]=>
string(4) "1998"
["prix_ht"]=>
float(20.79)
["prix_ht_tot"]=>
float(41.58)
["date"]=>
string(10) "2007-04-22"
}
}
Je cherche à faire la somme des "prix_ht_tot"...
Comment faire ?
J'extrais les données avec ceci :
Code :
- foreach($_SESSION['facture'] as $tableau){
- echo $tableau['prix_ht_tot'] ."<br />";
- }
|
mais je ne vois pas comment les additionner... Et comme ces données se trouvent dans des tableaux différents, array_sum() ne marche pas....
Merci pour vos idées !