IMG-LOGO
Home Tutorial Strip the string from HTML tags:

Strip the string from HTML tags:

by MH RISHAD - 13 Nov 2018
IMG

Strip the string from HTML tags:

<?php
echo strip_tags("Hello <b>world!</b>");
?>

Definition and Usage

The strip_tags() function strips a string from HTML, XML, and PHP tags.

Note: HTML comments are always stripped. This cannot be changed with the allow parameter.

Note: This function is binary-safe.

Syntax

             strip_tags(string,allow)

Ex 1

Strip the string from HTML tags, but allow <b> tags to be used

<?php
echo strip_tags("Hello <b><i>world!</i></b>","<b>");
?>

 Thank You

Share:

Leave a Comment

Required fields are marked *