rollDice2.php
Source of rollDice2.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/xml; charset=utf-8" />
<title>rollDice2.php</title>
</head>
<body>
<h1>RollDice 2</h1>
<h2>Uses Functions</h2>
<?php
function rollDie(){
$roll = rand(1,6);
$image = "die$roll.jpg";
print <<< HERE
<img src = "$image"
alt = "roll: $roll" />
HERE;
} // end rollDie
for ($i = 0; $i < 5; $i++){
rollDie();
} // end for loop
?>
</body>
</html>