1//this infinte loop never stops until the if condition became true
2while(1){
3 if(/*condition to exit from while*/);break;}
4 ob_flush();
5 flush();
6 sleep(2);
7 }
1$interval=60; //minutes
2 set_time_limit( 0 );
3 $sleep = $interval*60-(time());
4
5 while ( 1 ){
6 if(time() != $sleep) {
7 // the looping will pause on the specific time it was set to sleep
8 // it will loop again once it finish sleeping.
9 time_sleep_until($sleep);
10 }
11 #do the routine job, trigger a php function and what not.
12 }