$matchList = [];
#$wordList = array_splice($wordList,0,2000);
foreach ($wordList as $wordPair) {
    $wordSplit = explode(",", $wordPair);
    $word = trim($wordSplit[0]);
    $vaypatu = trim($wordSplit[1]);
    $wordL = tam2lat($word);
    $wordSyll = str_split($wordL, 2);
    $wordLen = count($wordSyll);
    $wordMatra = $ptreeA->GetMatraCount($wordL);
    # Selectors based on options
    if ($_POST['todaiSel'] == "none") {
        $todaiSel = True;
    } else {
        if ($_POST['todaiSel'] == "etukai") {
            $todaiSel = $ptreeA->checkEtukai($source, $wordL);
        } else {
            if ($_POST['todaiSel'] == "monai") {
                $todaiSel = $ptreeA->checkMonai($source, $wordL);
            } else {
                if ($_POST['todaiSel'] == "iyaipu") {
                    $todaiSel = $ptreeA->checkIyaipu($source, $wordL);
                } else {
                    if ($_POST['todaiSel'] == "first") {
                        $todaiSel = substr($wordL, 0, $_POST['todaiSelN'] * 2) == substr($source, 0, $_POST['todaiSelN'] * 2);
                    } else {
                        if ($_POST['todaiSel'] == "last") {
                            $todaiSel = substr($wordL, -$_POST['todaiSelN'] * 2) == substr($source, -$_POST['todaiSelN'] * 2);
                        }
                    }
                }