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