php clear buffer code example Example 1: php clear ob ob_clean(); Example 2: php clean all output buffers while ( ob_get_level() ) { ob_end_clean(); }