0
<?php


$faces = array ('4', '1', '2', '3', '6', '5');

$payouts = array (
    '1|1|1' => '0,01',
    '2|2|2' => '0,02',
    '3|3|3' => '0,03',
    '4|4|4' => '0,05',
    '5|5|5' => '0,07',
    '6|6|6' => '0,10',
);


$wheel1 = array();
foreach ($faces as $face) {
    $wheel1[] = $face;
}
$wheel2 = array_reverse($wheel1);
$wheel3 = $wheel1;
?>
<center>
<?php
if (isset($_POST['payline'])) {
    list($start1, $start2, $start3) = unserialize($_POST['payline']);
} else {
    list($start1, $start2, $start3) = array(0,0,0);
}

$stop1 = rand(count($wheel1)+$start1, 10*count($wheel1)) % count($wheel1);
$stop2 = rand(count($wheel1)+$start2, 10*count($wheel1)) % count($wheel1);
$stop3 = rand(count($wheel1)+$start3, 10*count($wheel1)) % count($wheel1);

$result1 = $wheel1[$stop1];
$result2 = $wheel2[$stop2];
$result3 = $wheel3[$stop3];

echo "Result: " . $result1 . ' ' . $result2 . ' ' . $result3 . "<br />";

if (isset($payouts[$result1.'|'.$result2.'|'.$result3])) {
    // give the payout
    echo "You won : " . $payouts[$result1.'|'.$result2.'|'.$result3];

}

?>

<br />
<form method='post'>
<input type='hidden' name='payline' value='<?php echo serialize(array($stop1, $stop2, $stop3)) ?>' />
<input type='submit' value='spin the wheel' />
</form>
<center>

who can help me ? :)

3
Contributors
2
Replies
12
Views
3 Years
Discussion Span
Last Post by Tpojka
0
$faces = array ('4', '1', '2', '3', '6', '5');
$wheel1 = array();
foreach ($faces as $face) {
    $wheel1[] = $face;
}

Wouldn't be simplier:$wheel1 = $faces;?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.