Last active
September 11, 2015 01:33
-
-
Save tqyq/d2533ad81754f5ffb8f0 to your computer and use it in GitHub Desktop.
tidyHTML php format html to dom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tidyHTML($buffer) { | |
// load our document into a DOM object | |
$dom = new DOMDocument(); | |
// we want nice output | |
$dom->preserveWhiteSpace = false; | |
$dom->loadHTML($buffer); | |
$dom->formatOutput = true; | |
return($dom->saveHTML()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment