je cherche à boucler un tableau mais j'ai un warning sur mon foreach ?
Mon but est d'afficher une image aléatoire mais rien ne fonctionne ?
Le warning dit que la flèche n'est pas bonne, je comprend plus rien ????
Code : Tout sélectionner
Parse error: parse error, unexpected T_DOUBLE_ARROW in C:\wamp\www\anaska\projet\inc_html\img_aleatoire.php on line 16<?php
$voiture=array("http://creatif-web.be/anaska/projet/img/blue.jpg", "http://creatif-web.be/anaska/projet/img/carrera.gif", "http://creatif-web.be/anaska/projet/img/carrera1.gif",
"http://creatif-web.be/anaska/projet/img/gray.jpg",
"http://creatif-web.be/anaska/projet/img/red.jpg",
"http://creatif-web.be/anaska/projet/img/red1.jpg");
$contenu=count($voiture);
$alea=mt_rand(1, 6);
echo $alea;
foreach($voiture => $key as $val) {
echo "$key et $val";
}
//$hasard=array_values($voiture);
//$attt=implode($hasard);
/*foreach($voiture as $val) {
echo "$val<br />";
exit(mt_rand());
}*/
//echo "$hasard";
//echo mt_rand($attt,$attt);
?>
Merci