Skip to content

Instantly share code, notes, and snippets.

@dawehner
Created November 21, 2016 11:53
Show Gist options
  • Select an option

  • Save dawehner/7cf96dc2e9b7f0d2bbb2f81b04bfc2c1 to your computer and use it in GitHub Desktop.

Select an option

Save dawehner/7cf96dc2e9b7f0d2bbb2f81b04bfc2c1 to your computer and use it in GitHub Desktop.
public static function removeHtmlTags($string, array $tags = []) {
$dom = Html::load($string);
foreach ($tags as $tag) {
foreach ($dom->getElementsByTagName($tag) as $places) {
$places->parentNode->removeChild($places);
}
}
return $dom->saveHTML();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment