php clear output buffer before header code example Example: php clean all output buffers while ( ob_get_level() ) { ob_end_clean(); }