<html><body><?php // bingo machine session_start(); // get from turn $turn = empty($_GET["turn"]) ? 0 : interval($_GET["turn"]); if($turn == 0|| empty($_SESSION["numbers"])){ $numbers = array(); for ($i = 1; $i <= 75; $i++){ $numbers[$i] = $i; } shuffle($numbers); // save session $_SESSION["numbers"] = $numbers; } $numbers = $_SESSION["numbers"]; $num = $numbers[$turn]; $now_turn = $turn + 1; $next = ($turn + 1) % 75; echo "<p>{$now_turn}ターン目</p>"; echo"<h1>$num</h1>"; echo "<p><a href='bingo.php?turn=$next'>next number</a></p>"; ?></body></html>