Skip to content

Instantly share code, notes, and snippets.

@imlinus

imlinus/compress_page

Last active Dec 12, 2016
Embed
What would you like to do?
php
<?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
You can’t perform that action at this time.