parse_url()
parse_url - Parse a URL and return its components
Syntax
mixed parse_url (
string $url,
int $component)
Arguments
- url - Specify one of PHP_URL_SCHEME, PHP_URL_HOST, PHP_URL_PORT, PHP_URL_USER, PHP_URL_PASS, PHP_URL_PATH, PHP_URL_QUERY or PHP_URL_FRAGMENT to retrieve just a specific URL component as a string.
- component
Description
This function parses a URL and returns an associative array containing any of the various components of the URL that are present.
Version
PHP 4, 5
Return value
On seriously malformed URLs, parse_url() may return FALSE and emit a E_WARNING. Otherwise an associative array is returned, whose components may be (at least one): scheme - e.g. http host port user pass path query - after the question mark ? fragment - after the hashmark #