Skip to content

Instantly share code, notes, and snippets.

@tiaro
Created October 21, 2012 08:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tiaro/3926407 to your computer and use it in GitHub Desktop.
Save tiaro/3926407 to your computer and use it in GitHub Desktop.
Strip the UTF-8 BOM mark (hex value: EF BB BF)
function trimUTF8BOM($data){
if(strlen($data) >= 3 && substr($data, 0, 3) == pack('CCC', 239, 187, 191)) {
return substr($data, 3);
}
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment