Mam na myśli jedno słowo. Spróbuj je odgadnąć:
Masz dostęp do sześciu podpowiedzi:
// Słowo do odgadnięcia $word = 'dominikanska'; // Podpowiedzi $hints = [ 'Pierwsza litera: '.$word[0], 'Ostatnia litera: '.$word[strlen($word) - 1], 'Liczba liter: '.strlen($word), 'Druga litera: '.$word[1], 'Przedostatnia litera: '.$word[strlen($word) - 2], 'Losowa litera: '.$word[rand(0, strlen($word) - 1)], ]; // Sprawdzamy, czy użytkownik wybrał jedną z podpowiedzi if (isset($_POST['hint1'])) { echo $hints[0]; } elseif (isset($_POST['hint2'])) { echo $hints[1]; } elseif (isset($_POST['hint3'])) { echo $hints[2]; } elseif (isset($_POST['hint4'])) { echo $hints[3]; } elseif (isset($_POST['hint5'])) { echo $hints[4]; } elseif (isset($_POST['hint6'])) { echo $hints[5]; } // Sprawdzamy, czy użytkownik wysłał odpowiedź z formularza if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['guess'])) { $guess = strtolower($_POST['guess']); if ($guess === $word) { echo 'Brawo, odgadłeś poprawne słowo!'; } else { echo 'Niestety, to nie to słowo. Spróbuj ponownie.'; } }