Hey. I have an array of words in the file, the user specifies the required number, and the specified number of words from the file are displayed in a random order:
<?php $src = file("file.txt"); $n = htmlspecialchars($_GET["words"]); $words = array_rand($src, $n); $result = array_map(function($key) use ($src) { return $src[$key]; }, $words); echo "<div class='word'>" . implode("<hr></div><div class='word'>", $result) . "</div>" ?> Displayed as:
<div class="results center"> <div class="word">витраж<hr></div> <div class="word">лапоть<hr></div> <div class="word">водопад<hr></div> <div class="word">пробка<hr></div> </div> There was a need to check the words that the user remembered. When you click on a button, input'y are added instead of words, where the user enters values (I’m supposed to understand how to do this). The question is how then to compare the array that was displayed to the user, with the values that he entered and ideally output the result with errors.