What are the best practices for handling character encoding issues in PHP scripts to prevent incorrect display of special characters?

Character encoding issues in PHP scripts can cause special characters to display incorrectly. To prevent this, it is important to ensure that the correct character encoding is used throughout your script. One way to handle this is by setting the appropriate character encoding in the header of your PHP script using the `header()` function with the `Content-Type` parameter set to the desired encoding (e.g. UTF-8).

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

// Your PHP script code here
?>