function _checkEqualSign($entry, $position)
    {
        $ret = true;
        //This is getting tricky
        //We check the string backwards until the position and count the closing an opening braces
        //If we reach the position the amount of opening and closing braces should be equal
        $length = strlen($entry);
        $open = 0;
        for ($i = $length - 1; $i >= $position; $i--) {
            $precedingchar = substr($entry, $i - 1, 1);
            $char = substr($entry, $i, 1);
            if (('{' == $char) && ('\\' != $precedingchar)) {
                $open++;
            }
            if (('}' == $char) && ('\\' != $precedingchar)) {
                $open--;
            }
        }
        if (0 != $open) {
            $ret = false;
        }
        //There is still the posibility that the entry is delimited by double quotes.
        //Then it is possible that the braces are equal even if the '=' is in an equation.
        if ($ret) {
            $entrycopy = trim($entry);
            $lastchar = $entrycopy{strlen($entrycopy) - 1};
            if (',' == $lastchar) {
                $lastchar = $entrycopy{strlen($entrycopy) - 2};
            }
            if ('"' == $lastchar) {
                //The return value is set to false
                //If we find the closing " before the '=' it is set to true again.
                //Remember we begin to search the entry backwards so the " has to show up twice - ending and beginning delimiter
                $ret = false;
                $found = 0;
                for ($i = $length; $i >= $position; $i--) {
                    $precedingchar = substr($entry, $i - 1, 1);
                    $char = substr($entry, $i, 1);
                    if (('"' == $char) && ('\\' != $precedingchar)) {
                        $found++;
                    }
                    if (2 == $found) {
                        $ret = true;
                        break;
                    }
                }
            }
        }
        return $ret;
    }
function _checkEqualSign($entry, $position)
    {
        $ret = true;
        //This is getting tricky
        //We check the string backwards until the position and count the closing an opening braces
        //If we reach the position the amount of opening and closing braces should be equal
        $length = strlen($entry);
        $open = 0;
        for ($i = $length - 1; $i >= $position; $i--) {
            $precedingchar = substr($entry, $i - 1, 1);
            $char = substr($entry, $i, 1);
            if (('{' == $char) && ('\\' != $precedingchar)) {
                $open++;
            }
            if (('}' == $char) && ('\\' != $precedingchar)) {
                $open--;
            }
        }
        if (0 != $open) {
            $ret = false;
        }
        //There is still the posibility that the entry is delimited by double quotes.
        //Then it is possible that the braces are equal even if the '=' is in an equation.
        if ($ret) {
            $entrycopy = trim($entry);
            $lastchar = $entrycopy{strlen($entrycopy) - 1};
            if (',' == $lastchar) {
                $lastchar = $entrycopy{strlen($entrycopy) - 2};
            }
            if ('"' == $lastchar) {
                //The return value is set to false
                //If we find the closing " before the '=' it is set to true again.
                //Remember we begin to search the entry backwards so the " has to show up twice - ending and beginning delimiter
                $ret = false;
                $found = 0;
                for ($i = $length; $i >= $position; $i--) {
                    $precedingchar = substr($entry, $i - 1, 1);
                    $char = substr($entry, $i, 1);
                    if (('"' == $char) && ('\\' != $precedingchar)) {
                        $found++;
                    }
                    if (2 == $found) {
                        $ret = true;
                        break;
                    }
                }
            }
        }
        return $ret;
    }
function _checkEqualSign ( $ entry , $ position ) { $ ret = true ; //This is getting tricky //We check the string backwards until the position and count the closing an opening braces //If we reach the position the amount of opening and closing braces should be equal $ length = strlen ( $ entry ) ; $ open = 0 ; for ( $ i = $ length - 1 ; $ i >= $ position ; $ i -- ) { $ precedingchar = substr ( $ entry , $ i - 1 , 1 ) ; $ char = substr ( $ entry , $ i , 1 ) ; if ( ( '{' == $ char ) && ( '\\' != $ precedingchar ) ) { $ open ++ ; } if ( ( '}' == $ char ) && ( '\\' != $ precedingchar ) ) { $ open -- ; } } if ( 0 != $ open ) { $ ret = false ; } //There is still the posibility that the entry is delimited by double quotes. //Then it is possible that the braces are equal even if the '=' is in an equation. if ( $ ret ) { $ entrycopy = trim ( $ entry ) ; $ lastchar = $ entrycopy { strlen ( $ entrycopy ) - 1 } ; if ( ',' == $ lastchar ) { $ lastchar = $ entrycopy { strlen ( $ entrycopy ) - 2 } ; } if ( '"' == $ lastchar ) { //The return value is set to false //If we find the closing " before the '=' it is set to true again. //Remember we begin to search the entry backwards so the " has to show up twice - ending and beginning delimiter $ ret = false ; $ found = 0 ; for ( $ i = $ length ; $ i >= $ position ; $ i -- ) { $ precedingchar = substr ( $ entry , $ i - 1 , 1 ) ; $ char = substr ( $ entry , $ i , 1 ) ; if ( ( '"' == $ char ) && ( '\\' != $ precedingchar ) ) { $ found ++ ; } if ( 2 == $ found ) { $ ret = true ; break ; } } } } return $ ret ; }
Checking whether the position of the '=' is correct

Sometimes there is a problem if a '=' is used inside an entry (for example abstract).
This method checks if the '=' is outside braces then the '=' is correct and true is returned.
If the '=' is inside braces it contains to a equation and therefore false is returned.

@access private
@param string $entry The text of the whole remaining entry
@param int the current used place of the '='
@return bool true if the '=' is correct, false if it contains to an equation
Checking whether the position of the = is correct