@Immutable
    public static Memory substr(String value, int start, int length) {
        int strLen = value.length();
        if (start < 0)
            start = strLen + start;

        if (start < 0 || start >= strLen)
            return Memory.FALSE;

        if (length == 0)
            return Memory.CONST_EMPTY_STRING;

        int end;

        if (length < 0)
            end = strLen + length;
        else
            end = (strLen < length) ? strLen : start + length;

        if (end <= start)
            return Memory.FALSE;
        else if (strLen <= end)
            return new StringMemory(value.substring(start));
        else
            return new StringMemory(value.substring(start, end));
    }
Parses the cslashes bitmap returning an actual bitmap.

@param charset the bitmap string

@return the actual bitmap
exts/jphp-zend-ext/src/main/java/org/develnext/jphp/zend/ext/standard/StringFunctions.java