What are the advantages of using the shuffle function in PHP to randomize question order?

When creating a quiz or questionnaire in PHP, it is important to randomize the order of the questions to prevent bias or pattern recognition by the users. One way to achieve this is by using the shuffle function in PHP, which randomly shuffles the elements of an array.

// Array of questions
$questions = array("Question 1", "Question 2", "Question 3", "Question 4", "Question 5");

// Shuffle the array to randomize question order
shuffle($questions);

// Loop through shuffled array to display questions
foreach($questions as $question) {
    echo $question . "<br>";
}