Hello. I am constructing a survey where the participants will be tested on their memory of a set of faces and labels, compared to new faces and labels, and need to randomly draw the order/number in which old versus new will be shown in the test. How does one, in PHP, determine the odd or even value of an integer from an array? Sosci seems to not support the function:
if ($number % 2) {some html code}
but the code:
if ($number & 2 == 0) {some html code}
seems to get me no where. Help!
Here is the code from the page where the number is drawn (LI38 is the number draw questions).
$j = loopPage(30);
$numbergen = 'LI38x'.sprintf('%02d', $j +1);
$oldfaceID = 'LI19x'.sprintf('%02d', $j +1);
$newfaceID = 'LI19x'.sprintf('%02d', $j +30);
$oldlabelID = 'LI36x'.sprintf('%02d', $j +1);
$newlabelID = 'LI36x'.sprintf('%02d', $j +30);
$oldface = value($oldfaceID, 'label');
$newface = value($newfaceID, 'label');
$oldlabel = value($oldlabelID, 'label');
$newlabel = value($newlabelID, 'label');
if (value($numbergen) & 2) {
html('
<div style="float:right;">
<img src="'.$oldface.'.jpg" style="width:300px;"/>
</div>
<div style="width:300px;margin-bottom:250px;margin-top:200px;text-align:center;">
<p>'.$oldlabel.'</p>
</div>
'); }
else {
html('
<div style="float:right;">
<img src="'.$newface.'.jpg" style="width:300px;"/>
</div>
<div style="width:300px;margin-bottom:250px;margin-top:200px;text-align:center;">
<p>'.$newlabel.'</p>
</div>
'); }
LI19 and LI36 draw 60 values from 90 possible values, in which the first 30 (LI19x01 and LI36x01 through LI19x30 and LI36x30) are shown in an encoding phase.