How do I remove backslashes from data?
How do I remove backslashes from data?
johnemc2
Posts: 4Questions: 2Answers: 0
I have problem of stripping slashes from the date that's saved in a database.
The date isn't saved with slashes, it's saved in readable format as e.g. 12/12/2016.
When Datatables serves it up to use via ajax, it looks like: 12\/12\/2016
Datatables won't display it with the slashes, I think.
Can't use the php function, stripslashes($result), because it's an array. Thanks in advance.
This discussion has been closed.
Answers
Update:
I was able to prevent json_encode from escaping the forward slashes in the date by using...
json_encode($res,JSON_UNESCAPED_SLASHES)