How can special characters like ÄÖÜß be properly recognized in PHP, even with UTF-8 encoding?

Special characters like ÄÖÜß may not be properly recognized in PHP when using UTF-8 encoding if the PHP file itself is not saved in UTF-8 format. To ensure proper recognition, save the PHP file in UTF-8 format without BOM (Byte Order Mark) and set the content-type header to UTF-8 in the PHP script.

<?php
header('Content-Type: text/html; charset=utf-8');

// Your PHP code here