How can Umlaute be properly encoded in URLs using PHP?

When encoding Umlaute (such as ä, ö, ü) in URLs using PHP, it is important to use the `urlencode()` function to ensure that the characters are properly encoded and do not cause any issues with the URL structure. This function will convert special characters into their URL-encoded format, allowing them to be safely included in the URL.

// Example of encoding Umlaute in a URL using PHP
$umlaut = 'ä';
$encoded_umlaut = urlencode($umlaut);
echo $encoded_umlaut; // output: %C3%A4