Skip to content

Instantly share code, notes, and snippets.

@adhipg
Created January 19, 2012 10:18
Show Gist options
  • Save adhipg/1639267 to your computer and use it in GitHub Desktop.
Save adhipg/1639267 to your computer and use it in GitHub Desktop.
remove empty html from a string
<?php
function removeEmptyHTML($html_replace="") {
while(preg_match("/<[^\/>]*>\s*<\/[^>]*>/", $html_replace)) {
$html_replace = preg_replace("/<[^\/>]*>\s*<\/[^>]*>/","",$html_replace);
}
return $html_replace;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment