FonksiyonPHP

Zar Atma Oyunu

PHP ile zar atma

 

<center>
<form action="" method="post" >
<input type="submit" value="ZAR AT" name="zar" />
</form>

<?php $zar1 = rand (1,6);
if (($_POST)){
echo "<br><img src='zarlar/$zar1.png'>";
}if ((@$_POST['zar']) and ($zar1 == 1)){
}if ((@$_POST['zar']) and ($zar1 == 2)){
}if ((@$_POST['zar']) and ($zar1 == 3)){
}if ((@$_POST['zar']) and ($zar1 == 4)){
}if ((@$_POST['zar']) and ($zar1 == 5)){
}if ((@$_POST['zar']) and ($zar1 == 6)){
}

$zar2 = rand (1,6);
if (($_POST)){
echo "<img src='zarlar/$zar2.png'>";
}if ((@$_POST['zar']) and ($zar2 == 1)){
}if ((@$_POST['zar']) and ($zar2 == 2)){
}if ((@$_POST['zar']) and ($zar2 == 3)){
}if ((@$_POST['zar']) and ($zar2 == 4)){
}if ((@$_POST['zar']) and ($zar2 == 5)){
}if ((@$_POST['zar']) and ($zar2 == 6)){
}

if ((@$_POST['zar']) and ($zar1 == $zar2)){

echo "<h3>Bravo! Çift Attın!</h3>";
}

?>
</center>

 

Zarlar

 

Demo

Bir Cevap Yazın

Başa dön tuşu