I wrote a sample code of while loop for a Dice Roll :
if dice is 6 the player is winner, otherwise the program shows just a text
<?php
$a = 0;
while ($a != 6) {
$a = rand(1,6);
echo 'The Dice is: ' . $a;
if ($a == 6) {
echo '<p>Super! You are the Winner</p>';
}else{
echo '<p>Sorry! You can try later...</p>';
}
}
echo '<p>Thank you for the Play!</p>';
?>
After refresh the page each time during this code, it shows different numbers of result?
And how can I set the specific time of repeating the code just with while?