How can setting the content type header in PHP affect the display of special characters in HTML pages?

Setting the content type header in PHP to specify the character encoding can affect how special characters are displayed in HTML pages. If the character encoding is not specified correctly, special characters may not display properly or may show up as garbled text. To ensure special characters are displayed correctly, it is important to set the content type header to specify the correct character encoding, such as UTF-8.

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