S
S
seredaes2015-11-24 13:25:04
PHP
seredaes, 2015-11-24 13:25:04

How to remove special characters like &nbs..?

I am getting an html string from the database. It is necessary to remove all tags and display to the user.
This is how I clean the variable: htmlentities(strip_tags($text), ENT_QUOTES, "UTF-8");
After $text = json_encode($text);
The & nbsp; tags remain in the string. – etc.
How to properly clean them all? str_replace doesn't seem like an option to me. I want to clear all the tags at once!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2015-11-24
@seredaes

First you need to make them html tags, and then clean them.
php.net/manual/ru/function.htmlspecialchars-decode.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question