public static function compare($string, $value, $length = 0) {
        $string = (string) $string;
        $value = (string) $value;

        if ($length > 0) {
            return strncasecmp($string, $value, $length);
        }

        return strcasecmp($string, $value);
    }