while.php

Source of while.php

<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>while.php</title>
  <style type="text/css">
    img {
      height: 40px;
      width: 50px;
    }
  </style>
</head>
<body>
  <h1>Dice Rolling Game 2</h1>
  <p>Welcome to the dice rolling game. See how many rolls it takes to get a six!</p>
  <div id = "output">
  <?php
  $userNumber = 999;
  $counter = 0;
  while ($userNumber != 6){
    $userNumber = rand(1,6);
    print <<< HERE
      <img src = "images/dado_$userNumber.png"
           alt = "$userNumber"
           height = "100px"
           width = "100px" />
HERE;
    $counter++;
  }
    print "<p>It took $counter tries to get a six.</p>";
  ?>
  </div>
  <p><a href="while.php">Try Again!</a></p>
</body>
</html>