infinite loop php

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

showing results for - "infinite loop php"
Geoff
21 Jan 2019
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        	}
Nabil
09 Nov 2020
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   }