What role does the Content-Type header play in displaying UTF-8 characters correctly in PHP?

The Content-Type header specifies the type of content being sent in the HTTP response. Setting the Content-Type header to "text/html; charset=utf-8" informs the browser that the content is HTML encoded in UTF-8, allowing it to correctly display UTF-8 characters. Without this header, the browser may not interpret the characters correctly, leading to display issues.

<?php
header('Content-Type: text/html; charset=utf-8');
// Your PHP code here
?>