public static function closeOutputBuffers($targetLevel, $flush) {
		$status = ob_get_status(true);
		$level = count($status);

		while ($level-- > $targetLevel
			   && (!empty($status[$level]['del'])
				   || (isset($status[$level]['flags'])
					   && ($status[$level]['flags'] & PHP_OUTPUT_HANDLER_REMOVABLE)
					   && ($status[$level]['flags'] & ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE))
				   )
			   )
		) {
			if ($flush) {
				ob_end_flush();
			} else {
				ob_end_clean();
			}
		}
	}
public static function closeOutputBuffers($targetLevel, $flush) {
		$status = ob_get_status(true);
		$level = count($status);

		while ($level-- > $targetLevel
			   && (!empty($status[$level]['del'])
				   || (isset($status[$level]['flags'])
					   && ($status[$level]['flags'] & PHP_OUTPUT_HANDLER_REMOVABLE)
					   && ($status[$level]['flags'] & ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE))
				   )
			   )
		) {
			if ($flush) {
				ob_end_flush();
			} else {
				ob_end_clean();
			}
		}
	}
public static function closeOutputBuffers ( $ targetLevel , $ flush ) { $ status = ob_get_status ( true ) ; $ level = count ( $ status ) ; while ( $ level -- > $ targetLevel && ( ! empty ( $ status [ $ level ] [ 'del' ] ) || ( isset ( $ status [ $ level ] [ 'flags' ] ) && ( $ status [ $ level ] [ 'flags' ] & PHP_OUTPUT_HANDLER_REMOVABLE ) && ( $ status [ $ level ] [ 'flags' ] & ( $ flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE ) ) ) ) ) { if ( $ flush ) { ob_end_flush ( ) ; } else { ob_end_clean ( ) ; } } }
Cleans or flushes output buffers up to target level.

@NOTE Function from Symfony\Component\HttpFoundation\Response

Resulting level can be greater than target level if a non-removable buffer has been encountered.

@param int  $targetLevel The target output buffering level
@param bool $flush       Whether to flush or clean the buffers
Cleans or flushes output buffers up to target level .