How can I strip all html using a preg_replace?
strip_tags only catches tags that have a beginning and end开发者_StackOverflow社区 tag. With the strings I'm working with it's causing issues and I need to removed all HTML tags.
If you want to clean some HTML, I would suggest using a real HTML parser, like HTMLPurifier.
Generally speaking, trying to manipulate HTML with regex tends to end badly...
<?php
$html = '<p>Lorem ipsum dolor <br>sit amet, <br />consectetur adipisicing elit</p>';
echo strip_tags($html);
?>
... prints:
Lorem ipsum dolor sit amet, consectetur adipisicing elit
精彩评论