[POO] Portée des variables
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| function addProduit($id, $nb) {
if ($id==0 || $nb==0) {
return false;
} else {
$n = count($this->$produits);
echo $n;
$this->$produits[$n]=$id;
echo "/".$this->$produits[$n]."/";
$this->$quantite[$n]=$nb;
return true;
}
} |
par contre, c'est bizarre :
Quand j'apelle ça :
Code:
1 2 3 4 5
| function getItem($i) {
$tab["prod"] = $this->$produits[$i];
$tab["qte"] = $this->$quantite[$i];
return $tab;
} |
ça me retourne TOUJOURS[1 ; 1]
z'avez une idée