I am trying to figure out how to write a function (or combination of functions) that will perform the same action as this code
Code: Select all
$bet = $_GET['bet'];
if ( ( $bet == 'even' && ( rand(1, 6) + rand(1, 6) ) % 2 == 0 ) ||
( $bet == 'odd' && ( rand(1, 6) + rand(1, 6) ) % 2 != 0 ) )
{
echo '<p>You win!</p>';
}
else
{
echo '<p>You lose!</p>';
}
I have tired a few different things that didnt work and I'm sure its a fairly simple function.
Any help or suggestions will be greatly appreciated
Thanks very much.