Hello, I was bored and made this for fun.
It's kinda sad

Play Stone, Paper, Scisser against the Computer!

DEMO: http://xcoderz.net/examples/sps.php

Source:
PHP Code: 
 <?php    
    
    
// Stone/Paper/Scissor v1
    // SPS.PHP - Coded by l0calh0st!
      
    
function play($play_1$play_2$won = array(120)){
        
            return (
$play_1 != $play_2) ? ($won[$play_1] == $play_2) ? ;
            
    }
  
   if (isset(
$_POST['submit'])){
  
        
$you $_POST['keuze'];
        
$computer rand(02);
  
        echo 
'<strong>';
        echo 
'The computer had ';
        
        if (
$computer == 0){
            echo 
'stone';
        }elseif (
$computer == 1){
            echo 
'scissor';
        }elseif (
$computer == 2){
            echo 
'paper';
   }
  
  
   echo 
' and you had ';
  
       if (
$you == 0){
            echo 
'stone';
       }elseif (
$you == 1){
            echo 
'scissor';
       }elseif (
$you == 2){
            echo 
'paper';
       }
      
       echo 
'</strong>';
       echo 
'<br /><br />';
      
       if(
play($you$computer) == 0){
            echo 
'<span style="color: red;">LOST!</span>';
       }elseif(
play($you$computer) == 1){
            echo 
'<span style="color: green;">WON!</span>';
       }elseif(
play($you$computer) == 2){
            echo 
'<span style="color: black;">DRAW!</span>';
       }
      
       echo 
'<br /><br />';
       echo 
'<a href="' $_SERVER['PHP_SELF'] . '">Play again!</a>';
  
   }else{
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<h3><em>Stone, Paper, Scissor!</em></h3>
Make your choice:&nbsp;
<select name="keuze">
<option value="0">Stone</option>
<option value="1">Scissor</option>
<option value="2">Paper</option>
</select>
<br /><br />
<input type="submit" name="submit" value="Play!">
</form>
<?php
}
?>
l0calh0st Reviewed by l0calh0st on . [PHP] Stone, Paper, Scissor Game! (Opensource) Hello, I was bored and made this for fun. It's kinda sad :| Play Stone, Paper, Scisser against the Computer! DEMO: http://xcoderz.net/examples/sps.php Source: <?php Rating: 5