Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // An array with the traditional old and new answers.
- $Answers = array
- (
- "It is certain!",
- "It is decidedly so!",
- "Without a doubt!",
- "Yes, definitely!",
- "You may rely on it!",
- "As I see it, yes!",
- "Most likely!",
- "Outlook good!",
- "Yes!",
- "Signs point to yes!",
- "Reply hazy try again.",
- "Ask again later.",
- "Better not tell you now.",
- "Cannot predict now.",
- "Concentrate and ask again.",
- "Don't count on it.",
- "My reply is no.",
- "My sources say no.",
- "Outlook not so good.",
- "Very doubtful.",
- "Yes, in due time.",
- "My sources say no.",
- "Definitely not.",
- "You will have to wait.",
- "I have my doubts.",
- "Outlook so so.",
- "Looks good to me!",
- "Who knows?",
- "Looking good!",
- "Probably.",
- "Are you kidding?",
- "Go for it!",
- "Don't bet on it.",
- "Forget about it."
- );
- // Count the array, generate random number from 0-(max array size) faster than array_rand().
- $Answer = $Answers[mt_rand(0, count($Answers) - 1)];
- // Display the original question with who asked, and answer.
- echo htmlspecialchars($_GET["From"]) . ' asks "' . htmlspecialchars($_GET["GeneralQuery"]) . '" Magic Eight Ball says: ' . $Answer;
- ?>
- Example: Magic8Ball.php?From=Myself&GeneralQuery=Should everyone release their APIs for an open community?
Add Comment
Please, Sign In to add comment