7) $t = 1; $test_title = "Alphabet Test"; $letters = array(); $letters[0][0] = array('ی', 'و'); $letters[0][1] = array('ay', 'aw'); $letters[1][0] = array('و', 'ر', 'د', 'ز', 'ژ', 'ذ'); $letters[1][1] = array('v', 'r', 'd', 'z', 'zh', 'z'); $letters[2][0] = array('ب', 'پ', 'ف', 'ت', 'ث', 'ک', 'گ'); $letters[2][1] = array('b', 'p', 'f', 't', 's', 'k', 'g'); $letters[3][0] = array('س', 'ش', 'ص', 'ض', 'ل', 'ق', 'ن'); $letters[3][1] = array('s', 'sh', 's', 'z', 'l', 'q', 'n'); $letters[4][0] = array('می', 'مو', 'یی', 'یو'); $letters[4][1] = array('may', 'maw', 'yay', 'yaw'); $letters[5][0] = array('ج', 'چ', 'ح', 'خ', 'غ'); $letters[5][1] = array('j', 'ch', 'h', 'kh', 'gh'); $letters[6][0] = array('هی', 'هو', 'های', 'هاو', 'ها'); $letters[6][1] = array('hay', 'haw', 'haai', 'haau', 'haa'); $letters[7][0] = array('طی', 'طو', 'ظی', 'ظو'); $letters[7][1] = array('tay', 'taw', 'zay', 'zaw'); if (isset($_POST['check'])) { $data = $_POST['data']; $newdata = explode(":", base64_decode($data)); $correct_answer = $newdata[0]; $letter_index = $newdata[1]; $vowel = $newdata[2]; $answers = explode(",", $newdata[3]); } else { srand((float)microtime() * 1000000); $answers = range(0, count($letters[$t][0])-1); shuffle($answers); $cnt = count($letters[$t][0])-1; $vowel = rand(0, 1); if ($t==6) { do { $correct_answer = rand(0, 3); // correct answer out of 4 } while ($answers[$correct_answer]>1); // 2-4 - are incorrect } elseif ($t==4 || $t==7) { $correct_answer = rand(0, 3); // correct answer out of 4 } else { // remove homonyms for ($i=1; $i<=$cnt; $i++) { for ($j=0; $j<$i; $j++) { if ($letters[$t][1][$answers[$i]]==$letters[$t][1][$answers[$j]]) { for ($k=$i; $k<$cnt; $k++) { $answers[$k] = $answers[$k+1]; } unset($answers[$cnt]); $cnt--; } } } if ($vowel==1) { // if the vowel is aw, v is deleted, because the combination vaw is not possible for ($i=0; $i3) break; if ($answers[$i]==0) { array_splice($answers, $i, 1); $i--; } } } $correct_answer = rand(0, 3); // correct answer out of 4 } $letter_index = $answers[$correct_answer]; // index of the correct letter $data = "$correct_answer:$letter_index:$vowel:".implode(",", $answers); $data = base64_encode($data); } ?> \n

$test_title

\n"; print "

You have answered the question correctly.
Try to answer another question.\n"; exit("

Back to the Persian Alphabet Tests

"); } print "\n"; } else { print "\n"; } ?>

You are wrong! Please try again!"; } print "

Listen to a consonant from Group $t followed by a diphthong and then select the same combination in Perso-Arabic script from the choices given."; ?>

*/ print ""; print ""; print ""; print "
"; } print "

"; ?>


Back to the Persian Alphabet Tests