Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End How to shuffle questions using php? Reply To: How to shuffle questions using php?

#149659
Migotn
Participant

ahlertjrs,

In php, one of the options would be to store the questions in an array and the use shuffle() function to assist in doing what you trying to achieve.

<?php
$question_array = array("Qa","Qb","Qc","Qd","Qe");

//Shuffle the array of questions
shuffle($question_array);

//print out the arrays to your screen or you may opt to save them yet to another array or variable for later use
print_r($question_array);
?>