Revision: 17718
Updated Code
at September 12, 2009 15:02 by iroybot
Updated Code
/**
* @param $string (X)HTML document string
* @return string
* @todo benchmark/optimize performance
*/
private function minimizeHTML($string) {
// will remove tabs, line breaks and extra white spaces
$r = preg_replace(array('/\r/','/\n/','/
/','/\t/'),'',$string);
$r = preg_replace('/\s\s+/',' ',$out);
return $r;
}
Revision: 17717
Updated Code
at September 12, 2009 10:19 by iroybot
Updated Code
/**
* @param $string (X)HTML document string
* @return string
* @todo benchmark/optimize performance
*/
private function minimizeHTML($string) {
// will remove tabs, line breaks and extra white spaces
$r = preg_replace(array('/\r/','/\n/','/
/','/\t/'),'',$string);
$r = preg_replace(array('/\s\s+/'),' ',$out);
return $r;
}
Revision: 17716
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 12, 2009 10:15 by iroybot
Initial Code
/**
* @param $string (X)HTML document string
* @return string
* @todo benchmark/optimize performance
*/
private function minimizeHTML($string) {
// will remove tabs, line breaks and extra white spaces
$out = preg_replace(array('/\r/','/\n/','/
/','/\t/'),'',$dom);
$out = preg_replace(array('/\s\s+/'),' ',$out);
return $out;
}
Initial URL
Initial Description
i know these regex stuff is rather slow, but still i like having slim documents. (don't forget to use gzip compression on all text docs)
Initial Title
HTML compression // white space removal
Initial Tags
php, line
Initial Language
PHP