@Immutable
    public static String stripcslashes(String source) {
        StringBuilder result = new StringBuilder(source.length());
        int length = source.length();
        for (int i = 0; i < length; i++) {
            int ch = source.charAt(i);

            if (ch == '\\') {
                i++;
                if (i == length) {
                    ch = '\\';
                } else {
                    ch = source.charAt(i);
                    switch (ch) {
                        case 'a':
                            ch = 0x07;
                            break;
                        case 'b':
                            ch = '\b';
                            break;
                        case 't':
                            ch = '\t';
                            break;
                        case 'n':
                            ch = '\n';
                            break;
                        case 'v':
                            ch = 0xb;
                            break;
                        case 'f':
                            ch = '\f';
                            break;
                        case 'r':
                            ch = '\r';
                            break;
                        case 'x':
                            // up to two digits for a hex number
                            if (i + 1 == length) {
                                break;
                            }
                            int digitValue = hexToDigit(source.charAt(i + 1));
                            if (digitValue < 0) {
                                break;
                            }
                            ch = digitValue;
                            i++;
                            if (i + 1 == length) {
                                break;
                            }

                            digitValue = hexToDigit(source.charAt(i + 1));
                            if (digitValue < 0) {
                                break;
                            }

                            ch = ((ch << 4) | digitValue);
                            i++;
                            break;
                        default:
                            // up to three digits from 0 to 7 for an octal number
                            digitValue = octToDigit((char) ch);
                            if (digitValue < 0) {
                                break;
                            }

                            ch = digitValue;
                            if (i + 1 == length) {
                                break;
                            }

                            digitValue = octToDigit(source.charAt(i + 1));
                            if (digitValue < 0) {
                                break;
                            }

                            ch = ((ch << 3) | digitValue);
                            i++;

                            if (i + 1 == length) {
                                break;
                            }

                            digitValue = octToDigit(source.charAt(i + 1));
                            if (digitValue < 0) {
                                break;
                            }

                            ch = ((ch << 3) | digitValue);
                            i++;
                    }
                }
            } // if ch == '/'

            result.append((char) ch);
        }

        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