public function parse($uri)
    {
        preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);

        $components = array();
        if (5 < count($match)) {
            $components =  array(
                'scheme'    => $match[2],
                'authority' => $match[4],
                'path'      => $match[5]
            );
        }
        if (7 < count($match)) {
            $components['query'] = $match[7];
        }
        if (9 < count($match)) {
            $components['fragment'] = $match[9];
        }

        return $components;
    }
public function parse($uri)
    {
        preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);

        $components = array();
        if (5 < count($match)) {
            $components =  array(
                'scheme'    => $match[2],
                'authority' => $match[4],
                'path'      => $match[5]
            );
        }
        if (7 < count($match)) {
            $components['query'] = $match[7];
        }
        if (9 < count($match)) {
            $components['fragment'] = $match[9];
        }

        return $components;
    }
public function parse ( $ uri ) { preg_match ( '|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|' , $ uri , $ match ) ; $ components = array ( ) ; if ( 5 < count ( $ match ) ) { $ components = array ( 'scheme' => $ match [ 2 ] , 'authority' => $ match [ 4 ] , 'path' => $ match [ 5 ] ) ; } if ( 7 < count ( $ match ) ) { $ components [ 'query' ] = $ match [ 7 ] ; } if ( 9 < count ( $ match ) ) { $ components [ 'fragment' ] = $ match [ 9 ] ; } return $ components ; }
Parses a URI into five main components

@param string $uri

@return array
Parses a URI into five main components