Reputation: 51
i need bypass all html tags to text, Im sure is there any way to bypass all html tags to text in format html, I ut my example below:
Example:
<p style="clear: both;"></p>
for
<p style="clear: both;"></p>
any function? thanks :)
Upvotes: 0
Views: 142
Reputation: 30488
use strip_tags
for removing html tags
$str = strip_tags("your string");
for displaying html tags use htmlspecialchars
htmlspecialchars("<html>something</html>"); // output <html>something</html>
Upvotes: 1
Reputation: 39550
You're probably searching for htmlentities()
:
$str = htmlentities('<p style="clear: both;"></p>');
var_dump($str);
or if you want to do it the other way around, use html_entity_decode()
:
$str = html_entity_decode('<p style="clear: both;"></p>');
var_dump($str);
Upvotes: 1