while.php

Source of for.php

<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>for.php</title>
  <style type="text/css">
    img{
      height: 40px;
      width: 50px;
    }
  </style>
</head>
<body>
  <h1>Dice Rolling Game</h1>
  <p>Welcome to the dice rolling game. Rolling 100 dice. How many will be sixes?</p>
  <p>
  <?php
  $sixCount = 0;
  
  for ($i = 0; $i < 100; $i++){
    $userNumber = rand(1,6);
    print <<< HERE
      <img src="images/dado_$userNumber.png"
           alt = "$userNumber"
           width = "20px"
           height = "20px" />
HERE;
  
    if($userNumber == 6){
        $sixCount++;
    } // end if
  } // end for
  
  print "</p><p>You rolled $sixCount six(es)!</p>";
  ?>
  
  <p><a href="for.php">Try Again!</a></p>

</body>
</html>