pretty print html tags - leebalaji1234/php GitHub Wiki

https://stackoverflow.com/questions/768215/php-pretty-print-html-not-tidy

`<?php 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()); }

// start output buffering, using our nice // callback function to format the output. ob_start("tidyHTML");

?>

<title>foo bar</title>

bar foo

It's like comparing apples to oranges.

`
⚠️ **GitHub.com Fallback** ⚠️