* @copyright 2021 Bartolomé Sintes Marco * @license http://www.gnu.org/licenses/agpl.txt AGPL 3 or later * @version 2021-12-02 * @link https://www.mclibre.org * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ // Se accede a la sesión session_name("cartas-3"); session_start(); if (!isset($_SESSION["baraja"])) { $_SESSION["baraja"] = []; foreach (["p", "c", "d", "t"] as $palo) { for ($i = 1; $i <= 7; $i++) { $_SESSION["baraja"][] = "$palo$i"; } for ($i = 11; $i <= 13; $i++) { $_SESSION["baraja"][] = "$palo$i"; } } shuffle($_SESSION["baraja"]); $_SESSION["jugador"] = []; $_SESSION["total"] = 0; } ?> Siete y medio. Juegos de cartas (1). Sesiones. Ejercicios. PHP. Bartolomé Sintes Marco. www.mclibre.org

Siete y medio (1)

Haga clic en el dorso de la carta para pedir otra carta:

\n"; print " \n"; foreach ($_SESSION["jugador"] as $carta) { print " \"$carta\"\n"; } if ($_SESSION["total"] > 7.5) { print " 😢️\n"; } elseif ($_SESSION["total"] == 7.5) { print " 😎️\n"; } print "

\n"; ?>