Inflection.php
private function _isShoda($vz, $txt)
    {
        $txt = mb_strtolower($txt, 'UTF-8');
        $vz = mb_strtolower($vz, 'UTF-8');
        $i = mb_strlen($vz, 'UTF-8');
        $j = mb_strlen($txt, 'UTF-8');

        if ($i === 0 || $j === 0) {
            return -1;
        }
        $i--;
        $j--;

        $nCmpReg = 0;

        while ($i >= 0 && $j >= 0) {
            if (mb_substr($vz, $i, 1, 'UTF-8') === ']') {
                $i--;
                $quit = 1;
                while ($i >= 0 && mb_substr($vz, $i, 1, 'UTF-8') !== '[') {
                    if (mb_substr($vz, $i, 1, 'UTF-8') === mb_substr($txt, $j, 1, 'UTF-8')) {
                        $quit = 0;
                        $this->aCmpReg[$nCmpReg] = mb_substr($vz, $i, 1, 'UTF-8');
                        $nCmpReg++;
                    }
                    $i--;
                }

                if ($quit === 1) {
                    return -1;
                }
            } else {
                if (mb_substr($vz, $i, 1, 'UTF-8') === '-') {
                    return $j + 1;
                }
                if (mb_substr($vz, $i, 1, 'UTF-8') !== mb_substr($txt, $j, 1, 'UTF-8')) {
                    return -1;
                }
            }
            $i--;
            $j--;
        }
        if ($i < 0 && $j < 0) {
            return 0;
        }
        if (mb_substr($vz, $i, 1, 'UTF-8') === '-') {
            return 0;
        }

        return -1;
    }
private function _isShoda($vz, $txt)
    {
        $txt = mb_strtolower($txt, 'UTF-8');
        $vz = mb_strtolower($vz, 'UTF-8');
        $i = mb_strlen($vz, 'UTF-8');
        $j = mb_strlen($txt, 'UTF-8');

        if ($i === 0 || $j === 0) {
            return -1;
        }
        $i--;
        $j--;

        $nCmpReg = 0;

        while ($i >= 0 && $j >= 0) {
            if (mb_substr($vz, $i, 1, 'UTF-8') === ']') {
                $i--;
                $quit = 1;
                while ($i >= 0 && mb_substr($vz, $i, 1, 'UTF-8') !== '[') {
                    if (mb_substr($vz, $i, 1, 'UTF-8') === mb_substr($txt, $j, 1, 'UTF-8')) {
                        $quit = 0;
                        $this->aCmpReg[$nCmpReg] = mb_substr($vz, $i, 1, 'UTF-8');
                        $nCmpReg++;
                    }
                    $i--;
                }

                if ($quit === 1) {
                    return -1;
                }
            } else {
                if (mb_substr($vz, $i, 1, 'UTF-8') === '-') {
                    return $j + 1;
                }
                if (mb_substr($vz, $i, 1, 'UTF-8') !== mb_substr($txt, $j, 1, 'UTF-8')) {
                    return -1;
                }
            }
            $i--;
            $j--;
        }
        if ($i < 0 && $j < 0) {
            return 0;
        }
        if (mb_substr($vz, $i, 1, 'UTF-8') === '-') {
            return 0;
        }

        return -1;
    }
Funkce vraci index pri shode koncovky (napr. isShoda('-lo','kolo'), isShoda('ko-lo','motovidlo'))
nebo pri rovnosti slov (napr. isShoda('molo','molo'). Jinak je navratova hodnota -1.

@param string $vz Vzor
@param string $txt Text

@return int Index shody nebo -1