What is the best practice for extracting specific values from a URL in PHP?

When extracting specific values from a URL in PHP, the best practice is to use the `parse_url` function to break down the URL into its components, and then use `parse_str` function to parse the query string parameters. This allows for easy access to specific values within the URL.

$url = "https://www.example.com/page?param1=value1&param2=value2";
$queryString = parse_url($url, PHP_URL_QUERY);
parse_str($queryString, $params);

// Access specific values
$value1 = $params['param1'];
$value2 = $params['param2'];

echo $value1; // Output: value1
echo $value2; // Output: value2