Function similar to strip_tags

2

Is there any kind of strip_tags that I pass by parameter elements that I DO NOT allow?

Suppose I have a string "blabkabla<span>bla<span><p>blablabla<p>" . I want to for example remove only <p> and not allow, only <span> .

    
asked by anonymous 25.05.2015 / 23:06

1 answer

2

I do not quite understand what you need, do you just want to allow the span in any case or have rule? Do you still want the content inside the P? What is the problem with strip_tags($string, '<span>') , I think it's better for you to say what you want, right?

To only allow what you want, use

strip_tags($string, '<span><br><qualquertag>')

To create a block list use

preg_replace("/<\/?(p|embed|object|frameset|frame|iframe|meta|link|style)[^>]*>/", '', $string)
    
26.05.2015 / 00:46