I am a bit lost with my code and been trying to solve my problem for quite a while now. I think it cannot be that hard but still I cnnot wrap my had around it. I have two questionnaires which I want to show to participants in a randomized order to avoid order effects in answering patterns. So my aim is to have one questionnaire on page 1 and the other on page 2, in randomized order. My code so far is as follows:
if (!isset($skalen)) {
$skalen = array (
'UM02', // scale 1
'GM01' // scale 2
);
shuffle ($skalen);
registerVariable($skalen);
$skalen[0];
}
on the next page, where the 2nd scale is to appear, I only have:
$skalen[1];
My problem is that the "shuffle" function does not shuffle my array. The scales always appear in the same order. I also tried it with the foreach() function like this:
if (!isset($skalen)) {
$skalen = array (
'UM02', // scale 1
'GM01' // scale 2
);
shuffle ($skalen);
registerVariable($skalen);
}
foreach ($skalen as $kennung) {
question($kennung);
}
$kennung[0];
and on the naxt page:
$kennung[1];
If I do it like this the scales appear in random order but each scale appears two times (3 scales on page one of my questionnaire and 1 scale on page two). I Just don't know how to put an end to this. I am really no expert and basically took all the syntax from a manual for the program I'm using for my questionnaire. I also tried to use "break" funtions to stop "foreach()" but I don't know how to tell "foreach()" to stop after mixing my scales once...
Would be great if someone could help. Thank you already :)
Aucun commentaire:
Enregistrer un commentaire