Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
Created January 5, 2017 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phpfiddle/25acd61c6e12ee49034e26a172806c2c to your computer and use it in GitHub Desktop.
Save phpfiddle/25acd61c6e12ee49034e26a172806c2c to your computer and use it in GitHub Desktop.
[ Posted by Josh ] Ethan's RPS
<!DOCTYPE html>
<html>
<head>
<title>RPS</title>
</head>
<body>
<h1>RPS</h1>
<?php
$numberPicked = rand(1, 3);
function whenClicked($numberPicked) {
if ($numberPicked == 1) {
echo "Rock";
} elseif ($numberPicked == 2) {
echo "Paper";
} elseif ($numberPicked == 3) {
echo "Scissors";
}
}
if (isset($_GET['submit'])) {
whenClicked($numberPicked, $_GET);
}
?>
<form action = "<?php $_PHP_SELF ?>" method = "GET">
<input type = "submit" name = "submit"/>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment