I have a form to upload a CSV file:
<form method="post" action="#" enctype="multipart/form-data" accept-charset="utf-8">
  <p><input type="file" name="file" /></p>
  <p><input type="submit" /></p>
</form>
On my PHP script I do the following:
$temp = $_FILES["file"]["tmp_name"];
$fobject = new SplFileObject($temp);
$fobject->setFlags(SplFileObject::READ_CSV);
$fobject->setCsvControl(',', '"');
$data = [];
foreach($fobject as $line) {
$data[] = $line;
  print_r($line);
}
Now there is a BOM in the file which shows as a 

in the first CSV row. How can I remove this?
I Googled and tried some solutions (How to remove multiple UTF-8 BOM sequences before "<!DOCTYPE>"?) but did not work.
I can use str_replace, but this does not seem like a best practice to me.