Link to home
Start Free TrialLog in
Avatar of Lennart Ericson
Lennart EricsonFlag for Sweden

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?
Avatar of krv123
krv123
Flag of United States of America image

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);
?>
Avatar of Lennart Ericson

ASKER

I meant the output to be like it is rendered by a browser. All html code need to be removed.
ASKER CERTIFIED SOLUTION
Avatar of shobinsun
shobinsun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial