This question already has an answer here:
im new to php, i want to generate a random number using mt_rand together with cookies, so that the number will only show once. everytime i generate a number it would check in the cookies, and it would never generate the same number within the range that is set. but the numbers well show multiple times at a time, within the range of 1-10. i tried the following code below
<?php
$random = mt_rand($range[0] , $range[1]);
if(!isset($_COOKIE[$random])){
echo $random;}else{}
?>
Aucun commentaire:
Enregistrer un commentaire