src/Url.php
private static function split($url)
    {
        $pos = strpos($url, '://');
        $scheme = substr($url, 0, $pos + 3);
        $url = substr($url, $pos + 3);

        if (false !== ($pos = strpos($url, '/'))) {
            $host = substr($url, 0, $pos);
            $url = substr($url, $pos);
        } else {
            // No path, only host
            $host = $url;
            $url = '/';
        }

        // At this point, we have $scheme, $host and $path
        $root = $scheme.$host;

        return array($root, $url);
    }
private static function split($url)
    {
        $pos = strpos($url, '://');
        $scheme = substr($url, 0, $pos + 3);
        $url = substr($url, $pos + 3);

        if (false !== ($pos = strpos($url, '/'))) {
            $host = substr($url, 0, $pos);
            $url = substr($url, $pos);
        } else {
            // No path, only host
            $host = $url;
            $url = '/';
        }

        // At this point, we have $scheme, $host and $path
        $root = $scheme.$host;

        return array($root, $url);
    }
private static function split ( $ url ) { $ pos = strpos ( $ url , '://' ) ; $ scheme = substr ( $ url , 0 , $ pos + 3 ) ; $ url = substr ( $ url , $ pos + 3 ) ; if ( false !== ( $ pos = strpos ( $ url , '/' ) ) ) { $ host = substr ( $ url , 0 , $ pos ) ; $ url = substr ( $ url , $ pos ) ; } else { // No path, only host $ host = $ url ; $ url = '/' ; } // At this point, we have $scheme, $host and $path $ root = $ scheme . $ host ; return array ( $ root , $ url ) ; }
Splits a URL into its host and the path.

```php
list ($root, $path) = Path::split("http://example.com/webmozart")
// => array("http://example.com", "/webmozart")

list ($root, $path) = Path::split("http://example.com")
// => array("http://example.com", "")
```

@param string $url The URL to split.

@return string[] An array with the host and the path of the URL.

@throws InvalidArgumentException If $url is not a URL.
Splits a URL into its host and the path .