Search code snippets, questions, articles...

Convert HTML code to plain text in PHP

    $html_code = '<p>Hello world</p>'
    echo strip_tags($html_code);
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place.

You can use strip_tags() function to convert HTML code to plain text in PHP. This will remove the basic HTML tags from the string and will return plain text string.

Was this helpful?