public static function removeUtf8Bom($text) { $bom = pack('H*', 'EFBBBF'); $text = preg_replace("/^{$bom}/", '', $text); return $text; }