PHP practical exam.

This commit is contained in:
2022-11-17 20:14:01 +01:00
parent 84cadf3fb4
commit 1693580525
15 changed files with 177 additions and 0 deletions

View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<title>Dice Game</title>
</head>
<body>
<h1>Ejercicio 1: El Juego del Dado Más Alto</h1>
<p>Actualice la página para una nueva tirada.</p>
<?php
$player1 = rand(1,6);
$player2 = rand(1,6);
?>
<table>
<tr>
<th>Jugador 1</th>
<th>Jugador 2</th>
<th>Resultado</th>
</tr>
<tr>
<td><img src="imgs/<?= $player1 ?>.svg" /></td>
<td><img src="imgs/<?= $player2 ?>.svg" /></td>
<td>
<?php
if($player1 > $player2)
echo "Ha ganado el jugador 1";
else if($player2 > $player1)
echo "Ha ganado el jugador 2";
else
echo "Han empatado";
?>
</td>
</tr>
</table>
<p>Última modificación de esta página: <?= date('Y-m-d', filemtime(__FILE__)) ?>
</body>
</html>