Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
[ Posted by Josh ] Ethan's rock paper scissors.
<!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