$url = 'https://www.example.com'; echo parse_url($url, PHP_URL_SCHEME); // outputs 'https'
$url = 'https://www.example.com?foo=bar'; if (strpos($url, 'foo=bar') !== false) { echo 'URL contains parameter "foo=bar"'; }
$url = 'https://www.example.com?foo=bar&baz=qux'; echo urlencode($url); // outputs 'https%3A%2F%2Fwww.example.com%3Ffoo%3Dbar%26baz%3Dqux'In this example, the `urlencode()` function is used to encode the URL. The package library used in these examples is the built-in PHP URL handling functions, which are part of the PHP core.