Revision: 45232
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 27, 2011 19:54 by trusktr
Initial Code
<?php function sanitize_output($buffer) { $search = array( '/\>[^\S ]+/s', //strip whitespaces after tags, except space '/[^\S ]+\</s', //strip whitespaces before tags, except space '/(\s)+/s' // shorten multiple whitespace sequences ); $replace = array( '>', '<', '\\1' ); $buffer = preg_replace($search, $replace, $buffer); return $buffer; } ob_start("sanitize_output"); ?>
Initial URL
http://ru.php.net/manual/en/function.ob-start.php#71953
Initial Description
Place this at the top of your php files. This will remove white space and formatting from HTML, making it smaller and faster for download by your users.
Initial Title
Minify the HTML that is outputted by PHP
Initial Tags
php, html
Initial Language
PHP