Crear un script en php, que genere 3 dígitos aleatorios del 1 hasta el 3
Crear un script en php, que genere 3 dígitos aleatorios del 1 hasta el 3. Cuando se muestre 3 dígitos iguales, aparecerá el mensaje: GANAS y en caso contrario aparecerá: PIERDES.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <?php $uno = rand(1,3); $dos = rand(1,3); $tres = rand(1,3); echo "número: "; echo $uno . "<br/>"; echo "número: "; echo $dos . "<br/>"; echo "número: "; echo $tres . "<br/>"; if ($uno == $dos) { if ($dos==$tres) { echo "GANASTE"; } else { echo "Perdiste"; } } ?> </body> </html> |