[su_youtube url=”https://www.youtube.com/watch?v=omoBBdcIc98″]
Premier exemple
$tableau = array(“un”,”deux”,”trois”);
for ($i=0;i<3;$i++)
echo “$tableau[$i]<br>”;
Boucle foreach
$tableau = array(“un”,”deux”,”trois”);
foreach ($tableau as $tab)
echo $tab;
Deuxième exemple
$fruits = array (“1” => “banane”,
“2” => “pomme”,
“3” => “fraise”);
echo $fruits[“2″].”<br>”;
foreach ($fruits as $cle=>$valeur)
echo $cle.”=”.$valeur.”<br>”;