php infinite loop

Solutions on MaxInterview for php infinite loop by the best coders in the world

showing results for - "php infinite loop"
Stefano
11 Mar 2016
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        	}
Jonas
15 Jul 2017
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   }