parse_url
parse_url — Parse a URL and return its components.Description
parse_url( string $url,This function parses a URL and returns an associative array containing any of the various components of the URL that are present. The values of the array elements are not URL decoded.
int $component = -1 ): mixed
This function is not meant to validate the given URL, it only breaks it up into the above listed parts. Partial and invalid URLs are also accepted, parse_url() tries its best to parse them correctly.
Parameters
string
The URL to parse.
int
The specific component to return. Use one of the following constants: 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
Return Values
On seriously malformed URLs, parse_url() may return false.If the component parameter is omitted, an associative array is returned. At least one element will be present within the array.
More information about parse_url on official PHP documentation site
parse_url - Popular snippets
- PHP 8.0 / MySQL 5.7 explode parse_url print_r
last run:
2022-04-21 17:27:26
6
- PHP 8.0 / MySQL 5.7 var_dump parse_url
last run:
2022-01-18 13:29:30
4
- PHP 8.0 / MySQL 5.7 printf print_r parse_url
last run:
2021-11-26 09:25:15
3
- PHP 8.0 / MySQL 5.7 parse_str parse_url var_export implode array_values
last run:
2021-05-20 06:31:09
3
- PHP 8.0 / MySQL 5.7 parse_url var_dump
last run:
2022-04-03 21:57:01
2
- PHP 5 / MySQL 5.7 var_dump parse_url
last run:
2022-01-18 14:25:25
2
- PHP 8.0 / MySQL 5.7 preg_match var_dump parse_url
last run:
2021-12-28 06:01:38
2
- PHP 8.0 / MySQL 5.7 file_get_contents printf print_r parse_url
last run:
2021-11-12 20:17:02
2
- PHP 8.0 / MySQL 5.7 var_dump parse_url
last run:
2021-09-30 18:18:09
2
- PHP 8.0 / MySQL 5.7 var_dump parse_url
last run:
2021-09-30 05:49:15
2
parse_url - New snippets
-
PHP 8.0 / MySQL 5.7 explode parse_url print_r
added at:
2022-04-21 14:20:49
6
-
PHP 8.0 / MySQL 5.7 explode parse_url
added at:
2022-04-21 14:19:48
1
-
PHP 8.0 / MySQL 5.7 explode parse_url
added at:
2022-04-21 14:19:40
1
-
PHP 8.0 / MySQL 5.7 explode parse_url
added at:
2022-04-21 14:19:27
1
-
PHP 8.0 / MySQL 5.7 parse_url var_dump
added at:
2022-04-03 17:18:13
2
-
PHP 8.0 / MySQL 5.7 parse_url getenv var_dump
added at:
2022-04-03 17:18:02
1
-
PHP 5 / MySQL 5.7 var_dump parse_url
added at:
2022-01-18 13:29:46
2
-
PHP 7 / MySQL 5.7 var_dump parse_url
added at:
2022-01-18 13:29:42
1
-
PHP 8.0 / MySQL 5.7 var_dump parse_url
added at:
2022-01-18 13:29:38
1
-
PHP 7 / MySQL 5.7 preg_match var_dump parse_url
added at:
2021-12-28 06:01:52
1