par
diabless6 » 09 févr. 2010, 18:48
Avec une boucle for, il suffit de faire une 2ème boucle pour parcourir les sous-tableaux.
<?php
$tab1=array('leparc','paris',"35");
$tab2=array('duroc','vincenne',"22");
$tab3=array('denoé','saint cloud',"47");
$clients=array($tab1,$tab2,$tab3);
echo'<br/><br/>';
for($i=0;$i<sizeof($clients);$i++)
{
print"Indice [$i] contient un {$clients[$i]} ";
for($y=0;$y<count($clients[$i]);$y++)
{
echo'<pre>';
print"- {$clients[$i][$y]} -" ;
echo'</pre>';
}
}
?>
Mais dans le cas plus haut, je ne vois pas comment créer la 2ème boucle.
Avec une boucle for, il suffit de faire une 2ème boucle pour parcourir les sous-tableaux.
[php]
<?php
$tab1=array('leparc','paris',"35");
$tab2=array('duroc','vincenne',"22");
$tab3=array('denoé','saint cloud',"47");
$clients=array($tab1,$tab2,$tab3);
echo'<br/><br/>';
for($i=0;$i<sizeof($clients);$i++)
{
print"Indice [$i] contient un {$clients[$i]} ";
for($y=0;$y<count($clients[$i]);$y++)
{
echo'<pre>';
print"- {$clients[$i][$y]} -" ;
echo'</pre>';
}
}
?>
[/php]
Mais dans le cas plus haut, je ne vois pas comment créer la 2ème boucle.