Assuming that the questions are being stored in an array (presumably after having been fetched from a database), there’s a couple of ways that you could go about it:
-
Use the array_rand() function to randomly choose 20 questions from an array of 80 potential questions.
-
Use shuffle() on the array and use while loop with a count to only loop though 20 times.