One bug in LWC's strip_tags function:
You must add a U option in the preg_replace to have it work when stripping content :
$str = 'test : <tag>blah</tag> hello <tag>blah</tag>';
$b = strip_only($str, 'tag', true);
will return "test : " without the U option
and return "test : hello" with it.
function strip_only($str, $tags, $stripContent = false) {
$content = '';
if(!is_array($tags)) {
$tags = (strpos($str, '>') !== false ? explode('>', str_replace('<', '', $tags)) : array($tags));
if(end($tags) == '') array_pop($tags);
}
if ($stripContent)
foreach($tags as $tag)
$str = preg_replace('#<'.$tag.'[^>]*>.+</'.$tag.'[^>]*>'.'#isU', '', $str);
else
foreach($tags as $tag)
$str = preg_replace('#'.'</?'.$tag.'[^>]*>'.'#is', '', $str);
return $str;
}
----
Server IP: 89.31.146.176
Probable Submitter: 88.180.118.222
----
Manual Page -- http://www.php.net/manual/en/function.strip-tags.php
Edit -- https://master.php.net/note/edit/98007
Del: integrated -- https://master.php.net/note/delete/98007/integrated
Del: useless -- https://master.php.net/note/delete/98007/useless
Del: bad code -- https://master.php.net/note/delete/98007/bad+code
Del: spam -- https://master.php.net/note/delete/98007/spam
Del: non-english -- https://master.php.net/note/delete/98007/non-english
Del: in docs -- https://master.php.net/note/delete/98007/in+docs
Del: other reasons-- https://master.php.net/note/delete/98007
Reject -- https://master.php.net/note/reject/98007
Search -- https://master.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.