Sumit Kumar
Sumit Kumar

Reputation: 580

Remove special character tag from my string

I am trying to remove all tag from my string and display it to the user My string is :

$abc='<ol><li>nice products </li></ol>';
echo  html_entity_decode($abc);
echo  htmlspecialchars_decode($abc);

But it is not removing these tag.can any one suggest me what I should use.
I am currently using php version 5.6

Upvotes: 1

Views: 61

Answers (2)

Vic Lee
Vic Lee

Reputation: 32

strip_tags() should solve your problem.

It is working in http://sandbox.onlinephpfunctions.com/ . Like you said PHP 5.6 environment. Copied your string

$abc='<ol><li>nice products </li></ol>';
echo strip_tags($abc);

Result is : nice products

Upvotes: 0

ssnake
ssnake

Reputation: 375

if you want to remove all html tags use strip_tags() function:

$abc = '<ol><li>nice products </li></ol>';
echo strip_tags($abc);

Upvotes: 2

Related Questions