//this infinte loop never stops until the if condition became true while(1){ if(/*condition to exit from while*/);break;} ob_flush(); flush(); sleep(2); }