Search code snippets, questions, articles...

Convert HTML code to plain text in PHP

<?php
    $html_code = '<p>Hello world</p>'
    echo strip_tags($html_code);
?>

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?
0 Comments
Programming Feeds
Learn something new everyday on Devsheet