Lennart Ericson
asked on
Is there a way to remove html entities?
In a script I try to use a html page to produce a .doc file. The html page is derived from a database. Right now the html code is written as it is to the file. I would like to remove the html code and use only the basic text. Is that possible?
http://northsalemcrew.net/forum/index.php?topic=308.0
Yes, you can use the strip_tags functions:
http://uk.php.net/strip_tags
<?php
$sHTML = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';
echo strip_tags($sHTML);
?>
http://uk.php.net/strip_tags
<?php
$sHTML = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';
echo strip_tags($sHTML);
?>
ASKER
I meant the output to be like it is rendered by a browser. All html code need to be removed.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.