protected static String _substr_replace(String string, String replacement, int start, int length) {
        int strLength = string.length();
        if (start > strLength)
            start = strLength;
        else if (start < 0)
            start = strLength + start;

        if (start < 0)
            start = 0;

        int end;
        if (length < 0)
            end = Math.max(strLength + length, start);
        else
            end = (strLength < length) ? strLength : (start + length);

        StringBuilder result = new StringBuilder();

        result.append(string, 0, start);
        result.append(replacement);
        result.append(string.substring(end));

        return result.toString();
    }
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