What are some potential functions or methods in PHP that can be used to manipulate URLs and extract specific information?

When working with URLs in PHP, you may need to manipulate them to extract specific information such as the domain name, path, query parameters, or fragments. PHP provides several built-in functions and methods to help with this, such as parse_url(), parse_str(), and $_GET.

// Example: Extracting domain name from a URL
$url = "https://www.example.com/path/to/page?query=123";
$domain = parse_url($url, PHP_URL_HOST);
echo $domain; // Output: www.example.com