public static Memory parse_url(String url, int component) {
        try {
            URI uri = URI.create(url);

            switch (component) {
                case 0:
                    return uri.getScheme() == null ? Memory.NULL : StringMemory.valueOf(uri.getScheme());
                case 1:
                    return uri.getHost() == null ? Memory.NULL : StringMemory.valueOf(uri.getHost());
                case 2:
                    return uri.getPort() == -1 ? Memory.NULL : LongMemory.valueOf(uri.getPort());
                case 3:
                case 4:
                    return uri.getUserInfo() != null ? Memory.NULL : StringMemory.valueOf(uri.getUserInfo());
                case 5:
                    return uri.getPath() != null ? Memory.NULL : StringMemory.valueOf(uri.getPath());
                case 6:
                    return uri.getQuery() != null ? Memory.NULL : StringMemory.valueOf(uri.getQuery());
                case 7:
                    return uri.getFragment() != null ? Memory.NULL : StringMemory.valueOf(uri.getFragment());
                case -1:
                    ArrayMemory result = new ArrayMemory();
                    if (uri.getScheme() != null) {
                        result.refOfIndex("scheme").assign(uri.getScheme());
                    }

                    if (uri.getHost() != null) {
                        result.refOfIndex("host").assign(uri.getHost());
                    }

                    if (uri.getPort() != -1) {
                        result.refOfIndex("port").assign(uri.getPort());
                    }

                    if (uri.getPath() != null) {
                        result.refOfIndex("path").assign(uri.getPath());
                    }

                    if (uri.getUserInfo() != null) {
                        result.refOfIndex("user").assign(uri.getUserInfo());
                    }

                    if (uri.getQuery() != null) {
                        result.refOfIndex("query").assign(uri.getQuery());
                    }

                    if (uri.getFragment() != null) {
                        result.refOfIndex("fragment").assign(uri.getFragment());
                    }

                    return result.toConstant();
                default:
                    return Memory.FALSE;
            }
        } catch (IllegalArgumentException e) {
            return Memory.FALSE;
        }
    }
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