php strip_tags() function


  Translation results:

英[strɪp] 美[strɪp]

vi. Strip naked; perform a striptease; strip off

vt. Remove, strip off; deprive; delete; clear, dismantle

n. Strip, strip; strip (or forest, lake, etc.); (football player’s) sportswear

Third person singular: strips Plural: strips Present participle: stripping Past tense : stripped past participle: stripped

php strip_tags() functionsyntax

Function:Strip the HTML tags in the string

Syntax: strip_tags(string,allow)

Parameters:

ParametersDescription
string Required, Specifies the string to check.
allow Optional, specifies allowed tags. These tags will not be deleted.

Description: The strip_tags() function strips HTML, XML and PHP tags from the string. This function always strips HTML comments. This cannot be changed via the allow parameter. This function is binary safe.

php strip_tags() functionexample

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

Run instance»

Click the "Run instance" button to view the online instance

Output:

Hello world
<?php
$i = "<b>hello<i> php.cn</i></b>";
$j = strip_tags($i,'<i>');
echo $j;
?>

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

hello <i>php.cn</i>

Home

Videos

Q&A