I am working on page, that gives you (based on range input) random string from array. It works by form with post method, that goes to same website, where is that form. But I ran into problems. Mostly it gives same string, as it gave before, so I would like to somehow save key from array, and compare it to new randomly picked one. Problem is, that I am beginner, and I don't know how to do that. I would be really happy, if You could help me.
Current piece of code: ($vystup stands for output, $rageFactor is input from range, $rage0 - $rage4 are arrays containing strings)
if ($rageFactor == "0"){
$vystup = $rage0[array_rand($rage0)];
} else if ($rageFactor == "1"){
$vystup = $rage1[array_rand($rage1)];
} else if ($rageFactor == "2"){
$vystup = $rage2[array_rand($rage2)];
} else if ($rageFactor == "3"){
$vystup = $rage3[array_rand($rage3)];
}
Thanks :)
Aucun commentaire:
Enregistrer un commentaire