PHP multi choice quiz- how to show 20 random questions out of 80 questions

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:

  1. Use the array_rand() function to randomly choose 20 questions from an array of 80 potential questions.

  2. Use shuffle() on the array and use while loop with a count to only loop though 20 times.