Created
April 27, 2014 02:03
-
-
Save xombra/11335982 to your computer and use it in GitHub Desktop.
Comprimir Texto o sitio web
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
function compress($buffer) | |
{ $search = array('/\>[^\S ]+/s','/[^\S ]+\</s','/(\s)+/s',"/\s+/"); | |
$replace = array('>','<','\\1',' '); | |
$buffer = trim(preg_replace($search, $replace, $buffer)); | |
$buffer = str_replace(' }','}', $buffer); | |
$buffer = str_replace('{ ','{', $buffer); | |
return $buffer; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment