What impact can the presence of a BOM (Byte Order Mark) have on PHP scripts and how can it be resolved?

The presence of a BOM (Byte Order Mark) at the beginning of a PHP script can cause unwanted output or errors in the script. To resolve this issue, you can ensure that your PHP files are saved without the BOM by using a text editor that allows you to save files without including the BOM.

<?php
ob_start();
if (0 === strpos($content, pack('H*', 'EFBBBF'))) {
    $content = substr($content, 3);
}
ob_end_clean();