SaveSnippets
Community
Pricing
Sign In
Get Started
Community
Public Snippets
1
Code shared by the SaveSnippets community — browse, copy, and get inspired.
All Languages
Bash
Go
HTML
Java
JavaScript
Kotlin
PHP
Python
Rust
SQL
TypeScript
#bom
Clear
Tags
#php
#kotlin
#bash
#go
#sql
#rust
#typescript
#html
#java
#python
#files
#utils
#strings
#http
#concurrency
#async
#json
#arrays
#security
#types
#crypto
#database
#dates
#format
PHP
Detect & Strip Byte Order Mark
Some text editors prepend a UTF-8 BOM (0xEF 0xBB 0xBF) which breaks header() calls, JSON, and PHP output. Detect and strip it defensively when ingesting external files.
#php
#strings
#utf-8
#bom
#encoding