angelrulez7(2012-11-24 23:34:53)Klubadmin made a PHP slots snippet.
Source Code
<?php
//pick 3 random numbers 1-9
$first=rand(1,9);
$second=rand(1,9);
$third=rand(1,9);
//display them
echo "<h1>" .$first. " | " .$second. " | " .$third. "</h1>";
//if they all match
if($first == $second && $second == $third){
//jackpot
echo "You won stuff! ";
}else{
//if they don't all match, check for just two matching
if($first == $second){
//first-second match
echo "First two match! You win a bit of stuff.";
}
if($second == $third){
//second-third match
echo "Last two match! You win a bit of stuff.";
}
if($first == $third){
//first-third match
echo "First and last match! You win a bit of stuff.";
}
//or you failed completely
if($first != $second && $second != $third && $first != $third){
//none match
echo "You failed. You lose some stuff.";
}
}
echo "<h3>Refresh to try again.</h3>";
?>
This post has been edited one or more times, the last time was: 2012-11-24 23:40:13
Klubadmin made a PHP slots snippet.
<?php //pick 3 random numbers 1-9 $first=rand(1,9); $second=rand(1,9); $third=rand(1,9); //display them echo "<h1>" .$first. " | " .$second. " | " .$third. "</h1>"; //if they all match if($first == $second && $second == $third){ //jackpot echo "You won stuff! "; }else{ //if they don't all match, check for just two matching if($first == $second){ //first-second match echo "First two match! You win a bit of stuff."; } if($second == $third){ //second-third match echo "Last two match! You win a bit of stuff."; } if($first == $third){ //first-third match echo "First and last match! You win a bit of stuff."; } //or you failed completely if($first != $second && $second != $third && $first != $third){ //none match echo "You failed. You lose some stuff."; } } echo "<h3>Refresh to try again.</h3>"; ?>
2012-11-24 23:40:13