Is there a way to remove html entities?

Posted on 2009-04-23
Last Modified: 2013-12-12
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?
Question by:lericson
    LVL 1

    Expert Comment

    LVL 13

    Expert Comment

    Yes, you can use the strip_tags functions:

    $sHTML = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';

    echo strip_tags($sHTML);

    Author Comment

    I meant the output to be like it is rendered by a browser. All html code need to be removed.
    LVL 14

    Accepted Solution


    this is the thing you need:

    LVL 14

    Assisted Solution


    A very good tutorial is here:

    Thanks and Regards

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 Mobile App Development with PhoneGap

    PhoneGap can help you leverage your already existing HTML5, JavaScript, and CSS skills in order to create and deploy cross-platform mobile apps.This program comprehensively covers HTML5 mobile app development from top to bottom.

    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now