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. Warning: Undefined array key "url" in /code/templates_c/1147dd74356edff87ad358bc1914c2fbf5fa2dbf_0.file.parse_url.tpl.php on line 42 Warning: Attempt to read property "value" on null in /code/templates_c/1147dd74356edff87ad358bc1914c2fbf5fa2dbf_0.file.parse_url.tpl.php on line 42 Warning: Undefined array key "component" in /code/templates_c/1147dd74356edff87ad358bc1914c2fbf5fa2dbf_0.file.parse_url.tpl.php on line 42 Warning: Attempt to read property "value" on null in /code/templates_c/1147dd74356edff87ad358bc1914c2fbf5fa2dbf_0.file.parse_url.tpl.php on line 42
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.1 / MySQL 5.7 file_exists file_get_contents preg_match_all parse_url rtrim
last run:
2022-07-12 14:01:54
10
- PHP 8.0 / MySQL 5.7 explode parse_url print_r
last run:
2022-04-21 17:27:26
6
- PHP 8.1 / MySQL 5.7 parse_url var_dump parse_str
last run:
2023-09-12 17:42:28
5
- PHP 8.1 / MySQL 5.7 strpos parse_url parse_str
last run:
2023-06-23 05:25:00
5
- PHP 8.0 / MySQL 5.7 preg_match parse_url
last run:
2024-09-25 13:04:08
5
- PHP 8.1 / MySQL 5.7 parse_url implode array_slice explode print_r
last run:
2022-10-11 14:01:55
4
- PHP 8.0 / MySQL 5.7 var_dump parse_url
last run:
2022-01-18 13:29:30
4
- PHP 8.1 / MySQL 5.7 strpos file_get_contents preg_match_all parse_url rtrim
last run:
2022-07-09 18:58:28
3
- 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
parse_url - New snippets
-
PHP 8.1 / MySQL 5.7 print_r parse_url fopen stream_get_meta_data strpos explode trim
added at:
2024-06-08 22:46:42
1
-
PHP 8.1 / MySQL 5.7 print_r parse_url fopen stream_get_meta_data strpos explode trim
added at:
2024-06-08 22:46:28
1
-
PHP 8.1 / MySQL 5.7 print_r parse_url fopen stream_get_meta_data strpos explode trim
added at:
2024-06-08 22:35:34
2
-
PHP 8.1 / MySQL 5.7 print_r parse_url fopen stream_get_meta_data strpos explode trim
added at:
2024-06-08 22:35:26
2
-
PHP 8.1 / MySQL 5.7 print_r parse_url fopen stream_get_meta_data strpos explode trim
added at:
2024-06-08 22:34:56
1
-
PHP 8.1 / MySQL 5.7 print_r parse_url fopen stream_get_meta_data strpos explode trim
added at:
2024-06-08 22:34:31
1
-
PHP 8.0 / MySQL 5.7 preg_match parse_url
added at:
2024-04-03 16:27:29
1
-
PHP 8.0 / MySQL 5.7 parse_url
added at:
2024-02-19 09:05:33
1
-
PHP 8.0 / MySQL 5.7 parse_url
added at:
2024-02-19 09:01:10
1
-
PHP 8.0 / MySQL 5.7 parse_url
added at:
2024-02-19 09:00:54
1