forBreak.php

Source of forBreak.php

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>forBreak</title>
</head>
<body>
<h1>Dice Rolling Game 3</h1>
<p>Welcome to the dice rolling game. See how many rolls it takes to get 20 sixes. You can roll the dice up to 100 times!</p>
<p>
<?php
$bool = false;

for ($i = 0, $sixCount = 0; ; $i++){
	$userNumber = rand(1,6);
	print "<img src=\"die$userNumber.png\" />";

	if($userNumber == 6){
		$sixCount++;
	}

	if($i > 99 || $sixCount > 19){
		break;
	}
}

	print "</p><p>You rolled the dice $i times, and rolled $sixCount six(es)!</p>";
	if($sixCount < 20){
		print "<h2>You failed to roll 20 sixes!!!</h2>";
	}
?>

<p><a href="forBreak.php">Try Again!</a></p>
</body>
</html>