// THE REQUIRED QUESTIONS FOR EACH SURVEY AND ADDED ARGUMENTS FOR EACH QUESTION
$rq[1] = array(1,2,3,4,5,6,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,25,26,27,28,30,31,34,38,40,41,42,43,44,45,46,47,49,50,51,53,55,56,57,58,59,60,61,62,63,64,65,66,67);
$rq[2] = array(1,2,4,5,7,9,11,12,14,16,18,19,21,23,25,27,29,30,32,33,35,37);
$rq[3] = array(1,2,3,4,5,6,8,9,11,13,15,17,19,20);
$aa[3][4] = '&& $q[3] == "1"';
$rq[4] = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23,24,26,28,29,30,31,32,33,34,35,38,39,40,41,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61);
$rq[5] = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,23,24,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41);
$rq[6] = array(1,2,3,4,5,6,7,8,10,11,12,13,14,16,17,19);
$rq[7] = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28);
$rq[8] = array(1,2,3,4,6,7,8,10,11,13,15,17,19,20,21,22);
$rq[9] = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33);
$rq[10] = array(1,2,3,4,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38);
// FIND ERRORS
$count = count($rq[$survey_number]);
for ($i=0;$i< $count;$i++)
{
if(isset($aa[$survey_number][$i]))
{
$aa_echo = $aa[$survey_number][$i];
}
else
{
$aa_echo = "";
}
if($q[$rq[$survey_number][$i]] == "NULL")
{
echo $rq[$survey_number][$i].': Is null and its not ok.<br>';
}
else
{
echo $rq[$survey_number][$i].': Is '.$q[$rq[$survey_number][$i]].' not null.<br>';
}
}
The code is working AS IS but what i want to do (what i cant figure out) is how do i inject a string into an if statment so it reads the string as is and not check the string VAR like so
PHP Code:
if($q[$rq[$survey_number][$i]] == "NULL") // normal
if($q[$rq[$survey_number][$i]] == "NULL" $aa_echo) // with a string that should read as...
And on a side note, you may want to have a look at range().
Yeah i have a post-it note on my computer saying "look into range" lol, but really i have been trying eval() all friggin morning and i just cant get it to work, i have spent like 3 hours trying any and all variations of eval() i have seen in the manual =/
The only thing I have had any luck with is actually getting eval to work with but i still can get eval to dump the var as is into the if statement /bash things!
PHP Code:
// FIND ERRORS
$count = count($rq[$survey_number]);
eval("for (\$i=0;\$i< \$count;\$i++)
{
\$if_state = '\$q[\$rq[\$survey_number][\$i]] == \"NULL\"';
if(isset(\$aa[\$survey_number][\$i]))
{
\$if_state .= \$aa[\$survey_number][\$i];
}
if(\"\$if_state\")
{
echo \$rq[\$survey_number][\$i].': Is '.\$q[\$rq[\$survey_number][\$i]].' null and its not ok.<br>';
}
else
{
echo \$rq[\$survey_number][\$i].': Is '.\$q[\$rq[\$survey_number][\$i]].' not null.<br>';
}
};");
The above produces this...
1: Is NULL null and its not ok.
2: Is 1 null and its not ok.
3: Is 1 null and its not ok.
4: Is NULL null and its not ok.
5: Is NULL null and its not ok.
6: Is NULL null and its not ok.
8: Is NULL null and its not ok.
9: Is NULL null and its not ok.
11: Is NULL null and its not ok.
13: Is NULL null and its not ok.
15: Is NULL null and its not ok.
17: Is NULL null and its not ok.
19: Is NULL null and its not ok.
20: Is NULL null and its not ok.