Skip to content

Instantly share code, notes, and snippets.

@koen253janssen
Last active November 22, 2021 21:13
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koen253janssen/8164970 to your computer and use it in GitHub Desktop.
Save koen253janssen/8164970 to your computer and use it in GitHub Desktop.
PHP Dice script
<?php
/// Script start
/// Creates variable $dice and sets the content to a random number between the 1 and 6
$dice = rand(1,6);
/// Display $dice
echo $dice;
/// If $dice is a 6 then display echo message
if($dice == 6) {
echo "Good Job! you threw a 6.";
}
/// If $dice is lower then 3 display echo message
if($dice < 3) {
echo "Don't give up try again!";
}
/// Script end
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment