Skip to content

Instantly share code, notes, and snippets.

@fntneves
Created March 15, 2020 22:56
Show Gist options
  • Save fntneves/7f87e4c05d01580bdbd1b05cbce7e1fd to your computer and use it in GitHub Desktop.
Save fntneves/7f87e4c05d01580bdbd1b05cbce7e1fd to your computer and use it in GitHub Desktop.
Skip UTF8 BOM bytes
<?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