Created
March 15, 2020 22:56
-
-
Save fntneves/7f87e4c05d01580bdbd1b05cbce7e1fd to your computer and use it in GitHub Desktop.
Skip UTF8 BOM bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function skipUtf8Bom(\SplFileObject $file) | |
{ | |
if ($file->fread(3) !== pack('CCC', 0xEF, 0xBB, 0xBF)) { | |
$file->rewind(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment