Voici mon code :
Code : Tout sélectionner
$root = "images2";
$file = glob("$root/*.jpg", GLOB_BRACE);
$f01 = array_rand($file);
$f02 = array_rand($file);
$f03 = array_rand($file);
$f04 = array_rand($file);J'ai bien compris qu'il fallait que je fasse une boucle, mais après je ne sais pas quoi faire...
j'étais parti sur ça (c'est long et ça ne marche pas) :
Code : Tout sélectionner
$root = "images2";
$file = glob("$root/*.jpg", GLOB_BRACE);
$f01 = array_rand($file);
$f02 = array_rand($file);
while ($file[$f02] == $file[$f01]){
unset ($file[$f02]);
$f02 = array_rand($file);
}
$f03 = array_rand($file);
while ($file[$f03] == $file[$f01]){
unset ($file[$f03]);
$f03 = array_rand($file);
}
while ($file[$f03] == $file[$f02]){
unset ($file[$f03]);
$f03 = array_rand($file);
}
$f04 = array_rand($file);
while ($file[$f04] == $file[$f01]){
unset ($file[$f04]);
$f04 = array_rand($file);
}
while ($file[$f04] == $file[$f02]){
unset ($file[$f04]);
$f04 = array_rand($file);
}
while ($file[$f04] == $file[$f03]){
unset ($file[$f04]);
$f04 = array_rand($file);
}Merci.