removeOtherTagsThan

removeOtherTagsThan ( string code , array listOfTags , boolean _withInnerHTML ) : string

Remove from a code, HTML tags which are not in the list.

Example

removeOtherTagsThan("<div class=price>15€ <a href=http://site><span>More</span></a></div>",["a","span"])
 

Result : 15€ <a href=http://site><span>More</span></a>


See also

removeTags

Parameters

code

An HTML code

listOfTags

An array of tags (names of HTML tags) to remove

_withInnerHTML (optional)

default:false. If true, it removes all the inner content of the tag. Else it remove just the tag, not the inside content.