public static function escape($str, $quote = '`')
    {
        if (is_array($str)) {
            foreach ($str as $key => $value) {
                $str[$key] = static::escape($value);
            }

            return $str;
        }

        if ((static::$MODE & self::SQL_MODE_NO_ENCLOSING_QUOTES)
            && (! static::isKeyword($str, true))
        ) {
            return $str;
        }

        if (static::$MODE & self::SQL_MODE_ANSI_QUOTES) {
            $quote = '"';
        }

        return $quote . str_replace($quote, $quote . $quote, $str) . $quote;
    }
public static function escape($str, $quote = '`')
    {
        if (is_array($str)) {
            foreach ($str as $key => $value) {
                $str[$key] = static::escape($value);
            }

            return $str;
        }

        if ((static::$MODE & self::SQL_MODE_NO_ENCLOSING_QUOTES)
            && (! static::isKeyword($str, true))
        ) {
            return $str;
        }

        if (static::$MODE & self::SQL_MODE_ANSI_QUOTES) {
            $quote = '"';
        }

        return $quote . str_replace($quote, $quote . $quote, $str) . $quote;
    }
public static function escape ( $ str , $ quote = '`' ) { if ( is_array ( $ str ) ) { foreach ( $ str as $ key => $ value ) { $ str [ $ key ] = static :: escape ( $ value ) ; } return $ str ; } if ( ( static :: $ MODE & self :: SQL_MODE_NO_ENCLOSING_QUOTES ) && ( ! static :: isKeyword ( $ str , true ) ) ) { return $ str ; } if ( static :: $ MODE & self :: SQL_MODE_ANSI_QUOTES ) { $ quote = '"' ; } return $ quote . str_replace ( $ quote , $ quote . $ quote , $ str ) . $ quote ; }
Escapes the symbol by adding surrounding backticks.

@param array|string $str   the string to be escaped
@param string       $quote quote to be used when escaping

@return string
Escapes the symbol by adding surrounding backticks .