Created
June 2, 2015 09:22
-
-
Save luckyshot/3ac76a3f6addf718a854 to your computer and use it in GitHub Desktop.
Compress HTML output
This file contains hidden or 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
<?php | |
function compressHtml($html) { | |
return preg_replace( ['/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s'], ['>', '<', '\\1'], $html ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment