Signatur
parse_url(string $url, int $component = -1): mixed
Beschreibung
Kein vollwertiger URL-Validator, aber zuverlässig für gültige URLs.
Parameter
| Name | Typ | Default | Beschreibung |
|---|---|---|---|
| $url Pflicht | string | — | URL. |
| $component | int | -1 | PHP_URL_HOST, PHP_URL_PATH, ... |
Rückgabewert
Typ
array|string|null|false
Beschreibung
Komponenten oder
false.Beispiele
Alle Teile
<?php
print_r(parse_url('https://programmierung.net/sprache/php?ref=go'));
// scheme=>https, host=>programmierung.net, path=>/sprache/php, query=>ref=go