<?

function output($text = false, $t = 'out') {	
	if ($t == 'int') {
		$text = (int) $text;
	}
	if ($t == 'abs') {
		$text = abs((int) $text);
	}
	if ($t == 'html' or $t == 'out') {
		$text = htmlentities($text, ENT_QUOTES, 'UTF-8');
	}
	if ($t == 'out') {
		$text = bbcodes($text);
		$text = trim($text);
		$text = str_replace("	", "&nbsp;&nbsp;&nbsp;&nbsp;", $text);
		//Удаление более 3 переносов 
		$text = preg_replace('%((?:\r\n|\r|\n){3})[\r\n]+%', '$1', $text);
		$text = nl2br($text);
	}
	return $text;
}