A wrapper for PHP's parse_url() function that handles consistency in the return values across PHP versions.
Description
Across various PHP versions, schemeless URLs containing a ":" in the query are being handled inconsistently. This function works around those differences.
Parameters
$urlstring
The URL to parse.
$componentintoptional
The specific component to retrieve. Use one of the PHP predefined constants to specify which one. Defaults to -1 (= return all parts as an array).Default: -1
Return
mixed
False on parse failure; Array of URL components on success; When a specific component has been requested: null if the component doesn't exist in the given URL; a string or - in the case of PHP_URL_PORT - integer when it does. See parse_url()'s return values.
Uses · 2
str_starts_with()Polyfill for `str_starts_with()` function added in PHP 8.0.
wpmu_signup_blog_notification()Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked.
wpmu_signup_user_notification()Sends a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked.
Signature, return type and hooks compared across 5 parsed releases.
4.7.0
The $component parameter was added for parity with PHP's parse_url().from the docblock
4.4.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/http.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.