<?php
const UTF8_BOM = "\xEF\xBB\xBF";
function hasBom(string $s): bool {
return strncmp($s, UTF8_BOM, 3) === 0;
}
function stripBom(string $s): string {
return hasBom($s) ? substr($s, 3) : $s;
}
// Useful when reading user-uploaded CSV files written from Excel.
$csv = stripBom(file_get_contents('upload.csv'));
$lines = explode("\n", $csv);
Create a free account and build your private vault. Share publicly whenever you want.