Page 1 of 1

Removing HTML?

Posted: Fri Aug 13, 2004 8:30 am
by dwfait
How would you check each word to see if it bagan with a < and ended with a >, and then remove those words?

Posted: Fri Aug 13, 2004 8:40 am
by anjanesh
strip_tags(); - http://www.php.net/strip_tags

Code: Select all

<?php
$a="This is a sentence";
$b="This <b>is</b> a sentence";
$c=strip_tags($b);
echo $a.' - '.strlen($a).'<BR>'.$b.' - '.strlen($b).'<br>'.$c.' - '.strlen($c)
?>
This is a sentence - 18
This is a sentence - 25
This is a sentence - 18

Posted: Fri Aug 13, 2004 11:03 am
by m3mn0n
Well to answer your question: [php_man]ereg[/php_man]() & [php_man]str_replace[/php_man]().

But I recommend the method mentioned by anjanesh.