<?php
$mainstr = "<h2>Welcome to <b>PHPWorld</b></h2>";
echo "Text before remove:
" . $mainstr;
echo "
Text after remove:
" .
str_ireplace(array('<b>', '</b>', '<h2>', '</h2>'), '',
htmlspecialchars($mainstr));
?>
output:
Text before remove:
<h2>Welcome to <b>PHPWorld</b></h2>
Text after remove:
Welcome to PHPWorld