public static function sub($str, $start, $end = null)
    {
        // The $end argument must be left out of the function call when it's not used.
        // Passing null to these functions doesn't work.
        if (null !== $end) {
            return self::$use_mbstring
                ? mb_substr($str, $start, $end)
                : substr($str, $start, $end);
        } else {
            return self::$use_mbstring
                ? mb_substr($str, $start)
                : substr($str, $start);
        }
    }