PHP Remove HTML tags from a String :
<?php
$input="Hi this is <b>TechniqZone</b>";
$text = strip_tags($input, "");
echo $text;
?>
Output is Hi this is TechniqZone.
The above code remove all html tags from string.
Here strip_tags() function is used to remove tags from string.
string strip_tags ( string
$str
[, string $allowable_tags
] )$allowable_tags - You can use the optional second parameter to specify tags which should not be stripped.
<?php
$input="Hi this is lt;a href='http://techniqzone.blogspot.in'><b>TechniqZone</b>lt;/a>";
$text = strip_tags($input, "<b>");
echo $text;
?>
Output is Hi this is TechniqZone.
Here i allowed <b> tag from string.
0 comments:
Post a Comment