Last active
December 12, 2016 08:45
-
-
Save imlinus/6671d49b7d79f885a4884c202210bd19 to your computer and use it in GitHub Desktop.
php
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
<?php | |
function compress_page($buffer) { | |
$search = array("/<!–\{(.*?)\}–>|<!–(.*?)–>|[\t\r\n]|<!–|–>|\/\/ <!–|\/\/ –>|<!\[CDATA\[|\/\/ \]\]>|\]\]>|\/\/\]\]>|\/\/<!\[CDATA\[/" => ""); | |
$buffer = preg_replace(array_keys($search), array_values($search), $buffer); | |
return $buffer; | |
} | |
ob_start('compress_page'); | |
// Page here | |
ob_end_flush(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment