Online Snippets Library

Remove HTML,XML and PHP tags from String using PHP

To Remove HTML,XML and PHP tags from String in php , We will use strip_tags() funtion of PHP.strip_tags() function returns the stripped string.

Syntax

strip_tags(string,allowed tag)

Example

Strip HTML tags, but allow tags to be used:

<?php
echo strip_tags("Hi <b><u>Friends</u></b>","<u>");
?>

Out Put

Hello Friends