treehouse : what would you like to learn today?
Web Design Web Development iOS Development

How to shuffle questions using php?

  • I have a set of questions that are located in a XML file. Using php, I need to pull the questions from the XML file and shuffle the order of the questions each time they are displayed to the user.

    What is the best way to implement this?

    Please be specific in your instructions and syntax because I am fairly new to php programming?

    Thank you!
    John
  • If JavaScript is an option, I recently used James Padolsey's DOM shuffler to shuffle questions on a quiz thingy for a client:

    http://james.padolsey.com/javascript/shuffling-the-dom/

    I'm sure there is a PHP way to, which is probably smarter, but I'm not super hot with my PHP skillz =)
  • Hi Chris,

    Thank you for the information!

    John