Hello. My name is Sam and I'm learning php as a hobby so I understand if more urgent matters are taken care of before mines! My goal for now is to create a dice script where I roll a die and it prints out how many times it had to roll before it lands on a 6. Here is the code I have thus far.
<?php
//write your do-while loop below
$do {$roll = rand(1,6);
$rollCount ++;
switch ($roll) {
case(1):
case(2):
case(3):
case(4):
case(5):
break;
case(6):
echo "<p>It took {$rollCount} times!</p>";
break;
}
}
?>
but nothing happens. Sorry for the trouble. I find php fun so far and would love to learn more. Thanks for any help!