How can the issue of text output distortion be resolved in PHP?

Text output distortion in PHP can be resolved by setting the correct character encoding for the output. This can be achieved by using the header() function to specify the content type as text/html and the charset as UTF-8. Additionally, make sure that the PHP files themselves are saved in UTF-8 encoding to avoid any encoding issues.

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