'I', 'You', 'He', 'We', 'You (pl.)', 'They'); $question = $persons[$person]." ______."; // if ($person==3) $question .= eng3sgVerb($verb); // else $question .= $verb; // $question .= ". ".$persons[$q_person]." ______."; return $question; } $link = mysql_connect("localhost", $login, $pass) or die("Could not connect: " . mysql_error()); mysql_select_db($db) or die("Could not select database"); mysql_query("SET NAMES utf8;"); $isPersScript = !isset($_GET['trans']); if (isset($_GET['id'])) { $id = $_GET['id']; } else { $id = "all"; } if (isset($_POST['check'])) { $data = $_POST['data']; // $newdata = explode(":", $data); $newdata = explode(":", base64_decode($data)); $randomVerb = $newdata[0]; $engVerb = $newdata[1]; $persons = explode(",", $newdata[2]); $questions_data = explode(";", $newdata[3]); $questions = array(); for ($i=0; $i<6; $i++) array_push($questions, explode(",", $questions_data[$i])); $answers = explode(",", $newdata[4]); $qtypes = explode(",", $newdata[5]); if ($id!="all") { $where = "AND `testtype`=$id"; } else { $r = "AND (`testtype`=>0 AND `testtype`<=10)"; } $query = "SELECT * FROM pvc_verbs WHERE ".($isPersScript?"pers":"trans")."_inf=\"$randomVerb\" $where;"; $r = mysql_query($query); $row = mysql_fetch_assoc($r); $presStem = ($isPersScript) ? $row['pers_presstem'] : $row['trans_presstem']; $presStemTrans = $row['trans_presstem']; } else { if ($id!="all") { $r = mysql_query("SELECT * FROM pvc_verbs WHERE `testtype`=$id;"); } else { $r = mysql_query("SELECT * FROM pvc_verbs WHERE `testtype`>0 AND `testtype`<=10;"); } $verbCount = mysql_num_rows($r); srand((float)microtime() * 1000000); $randomVerb = rand(0, $verbCount-1); mysql_data_seek($r, $randomVerb); $row = mysql_fetch_assoc($r); if ($isPersScript) { $randomVerb = $row['pers_inf']; $presStem = $row['pers_presstem']; } else { $randomVerb = $row['trans_inf']; $presStem = $row['trans_presstem']; } $presStemTrans = $row['trans_presstem']; $engVerb = $row['translation']; $engVerbs = explode(',', $engVerb); $engVerb = trim($engVerbs[array_rand($engVerbs)]); // Select one verb if there are synonyms if (substr($engVerb, 0, 3)=='to ') $engVerb = substr($engVerb, 3); //Make a list of person numbers - the order of questions $persons = range(1, 6); shuffle($persons); $qtypes = array(0, 0, 0, 1, 1, 1); shuffle($qtypes); $answers = array(); $questions = array(); for ($i=0; $i<6; $i++) { if ($qtypes[$i]==1) $temp = array(2, 5, 7); else $temp = array(2, 5, 1); shuffle($temp); //Shuffle 3 tenses: 2 - Imperfect, 5 - Present Perfect, //7 - Present Indecative or 1 - Simple Past (correct) array_push($questions, $temp); for ($j=0; $j<3; $j++) { if ($questions[$i][$j]==1 || $questions[$i][$j]==7) { array_push($answers, $j); //Remember the number of the correct answer break; } } } $data = $randomVerb.":".$engVerb.":".implode(",", $persons).":"; for ($i=0; $i<6; $i++) $data .= implode(",", $questions[$i]).";"; $data .= ":".implode(",", $answers).":".implode(",", $qtypes); $data = str_replace(",;", ";", $data); $data = str_replace(";:", ":", $data); $data = base64_encode($data); } $pastStem = substr($randomVerb, 0, strlen($randomVerb)-2); ?> Boyle Pattern Test \n

Tenses

\n"; print "

You have answered all questions correctly. Try to conjugate another verb.\n"; exit("

Back to the Persian Tests"); } print "\n"; } else { print "\n"; } ?>

Tenses

Please change this verb whose infinitive means "to ", keeping the same person:

"> ".Conjugate($pastStem, $presStem, $presStemTrans, 1, $persons[$i-1]); print " (from the Simple Past to the Present Indicative)"; } else { print "

".Conjugate($pastStem, $presStem, $presStemTrans, 7, $persons[$i-1]); print " (from the Present Indicative to the Simple Past)"; } print ""; print ""; print "
".Conjugate($pastStem, $presStem, $presStemTrans, $questions[$i-1][0], $persons[$i-1])."
".Conjugate($pastStem, $presStem, $presStemTrans, $questions[$i-1][1], $persons[$i-1])."
".Conjugate($pastStem, $presStem, $presStemTrans, $questions[$i-1][2], $persons[$i-1])."
"; } print "

"; ?>


Persian Verb Conjugator

Back to the Persian Tests