note 71953 added to function.ob-start
| From: | TobiasGoldkamp at osu1 dot php dot net | Date: | Mon, 25 Dec 2006 23:02:55 +0000 |
| Subject: | note 71953 added to function.ob-start | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120911@lists.php.net to get a copy of this message | ||
I use this to strip unnecessary characters from HTML output:
<?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");
?>
----
Server IP: 217.13.201.10
Probable Submitter: 80.133.69.228
----
Manual Page -- http://www.php.net/manual/en/function.ob-start.php
Edit -- https://master.php.net/note/edit/71953
Del: integrated -- https://master.php.net/note/delete/71953/integrated
Del: useless -- https://master.php.net/note/delete/71953/useless
Del: bad code -- https://master.php.net/note/delete/71953/bad+code
Del: spam -- https://master.php.net/note/delete/71953/spam
Del: non-english -- https://master.php.net/note/delete/71953/non-english
Del: in docs -- https://master.php.net/note/delete/71953/in+docs
Del: other reasons-- https://master.php.net/note/delete/71953
Reject -- https://master.php.net/note/reject/71953
Search -- https://master.php.net/manage/user-notes.php