Bonjours à tous.
Voila j'ai un souci dans une classe.
Je voudrais créer un tableau comme avec comme index
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 <? class Commande { var $nomClient; var $listePizzas; function ajouterPizza($nbpizza,$nombre) { $this->listePizzas[$nbpizza] = $nombre; } function afficherCommande() { echo "Commande du client : ".$this->nomClient; for($i=0;$i<$nbpizza;$i++) { echo "<BR>Pizza(s): ".$this->listePizzas[$i]; } } } ?>
ListePizza[0] => Campagnarde
ListePizza[2] => Peperonni
etc...
Et je voudrais que dans ma boucle for il affiche :
Commande du client : Alex //cela sa fonctionne...
Pizza(s): Campagnarde
Pizza(s): Peperonni
Pizza(s): Giante
Quelqu'un aurait une idée ?
Partager