Skip to content

Instantly share code, notes, and snippets.

@aircokol
Last active April 1, 2022 07:42
Show Gist options
  • Save aircokol/cc721e35dfbd69c5ee6bd9b180570fd6 to your computer and use it in GitHub Desktop.
Save aircokol/cc721e35dfbd69c5ee6bd9b180570fd6 to your computer and use it in GitHub Desktop.
add BOM to fix UTF-8 in Excel
<?php
$fh = fopen($filename, 'w');
//add BOM to fix UTF-8 in Excel
fputs($fh, $bom =( chr(0xEF) . chr(0xBB) . chr(0xBF) ));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment