Hi, I am needing help with a dice code I am stuck on this assignment and cant seem to get past it…
I need to (1) Create two variables, $roll and $sum, both of which have a value of 0
(2) Create a while loop that will run 10 times. Keep track of what roll you’re on by increasing the $roll variable by 1 each time through the loop.
(3) Calculate a random number between 1 and 6.
(4) Print an image of the die cast based on the random number value. If the die images you saved above are in a folder called “dice” the statement in php looks something like
echo '<img src="dice/d1.jpg" width=10%>';]
to display a die with one dot.
(5) Add the value of the random number to $sum
(6) When the loop completes, you should create some space and a horizontal rule; then print the sum. Example results look something like: