I have an array of arrays. e.g
Code: Select all
$qlist = array(
array("What is your name?", "false"),
array("What is your age?", "true"),
array("What is your hair colour", "true"),
array("What is your favourite food?", "false"),
array("Do you like cheese", "true"),
array("Do you have a tv?", "false"),
array("Do you drink?", "false"),
...............etc
)Say I want to display 3 main questions at a time. I will want to display all the subquestions that go with it.
In my head the logic is something like this:
Code: Select all
start a loop
echo the first question
look at the next question in the array to see if it is a subquestion
if yes:
echo the subquestion
look at the next question in the array to see if it is a subquestion
if yes:
echo the subquestion
look at the next question in the array to see if it is a subquestion etc etc
if no:
next loop until 3 main questions have been displayedI think it may involve a while loop and next() but I'm not sure and I'm feeling like a complete noob again all of a sudden.
Must have taken too many blows to the head whilst snowboarding last week
Will continue to experiment in the meantime....