} public function start() { ob_start(array($this, '_obfunc_cb')); } public function stop() { ob_end_clean(); } public function flush($end = false) { if ($end) { ob_end_flush(); } else { ob_flush(); } } public function clean($end = false) { if ($end) { ob_end_clean(); } else { ob_clean(); } } } $b = new OutputBuffer(); $b->flush(); $b = new OutputBuffer(function ($data) { return strtoupper($data); }, ['autostart' => true]);