How can an array be used to store the results of correct guesses and display them at the end of the process?
To store the results of correct guesses in an array and display them at the end, you can create an empty array to store the correct guesses. Each time a guess is correct, you can push that guess into the array. Finally, you can loop through the array at the end to display all the correct guesses.
$correctGuesses = [];
// When a guess is correct
$correctGuess = "apple"; // example correct guess
array_push($correctGuesses, $correctGuess);
// Display correct guesses at the end
echo "Correct guesses: ";
foreach ($correctGuesses as $guess) {
echo $guess . ", ";
}