G
G
GrimJack2017-04-01 12:11:46
PHP
GrimJack, 2017-04-01 12:11:46

How to remove \ufeff from json string?

There is a json array string
["\ufeff1788","1789","1790"]
. How would it be correct to remove \ufeff from it ?
I tried this, but it didn't help:
$data = preg_replace('/\x{feff}$/u', '', $data);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
Wexter, 2017-04-01
@Wexter

$data = str_replace('\ufeff', '', $data)

V
VetalM82, 2021-10-13
@VetalM82

$result = trim($result, "\xEF\xBB\xBF");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question