Example 1 — Remove All Tags
Keep only the visible text.
<?php
$html = "<p>Hello <b>World</b></p>";
echo strip_tags($html), PHP_EOL; How It Works
- Start with HTML. It has
pandbtags. - Call strip_tags(). Every tag is removed.
- Text stays. Only the words remain.
- Print the result. It reads as plain text.

