The strip_tags() function searches for and removes an unlimited number of tags from a string. This function accepts and requires one parameter, and can remove tags with or without attributes.
Syntax:
strip_tags(source);
Example:
<html> <head>
<scripttype="text/javascript"> var src ="<strong>This piece of string is bold</strong> but this <em>isn't</em>"; var remove_tags = strip_tags(src);
echo(remove_tags); //this should output "This piece of string is bold but this isn't"
</script> </head> </html>
If you're familiar with PHP, you should have no trouble understanding how this function works. For a greater understanding, please test this function in your Web Console.
Additionally, you can play around with the demo below to see this function in action on a live webpage! Enter some text with at least one word covered in HTML tags, and then click "Remove tags" to see the text alerted without the tags.