How to remove HTML Tags from string?

Posted by 15 May, 2009

If your strings have image code, any html code or DIV code you can easily remove using this code.

<?Php
$str = preg_replace("/<.*?>/", "", $str);
?>

Hope this little code will be useful for you.

Share
Categories : Easy PHP Tags :

Comments
June 6, 2009

thanx,
this code is really work fine
thanx again , for help

Posted by Devphp
July 8, 2009

Isn’t strip_tags() better/faster?

Posted by Avram
August 21, 2009

Using regular expression you can better control your output.

Posted by om
July 11, 2011

thanks it is very nice

Posted by Anoop
December 16, 2011

thanks!!!!!!!

Posted by Rohit
Leave a comment

(required)

(required)


*