Sleep never continues execution Sleep never continues execution curl curl

Sleep never continues execution


I think you have an error in your logic.For example:When it's 5AMThen $secondsToSleep is 20*60 = 1200sec;When you call the sleep function you multiply it again with 20sleep($hours[$hour]*$secondsToSleep); => sleep(20*1200); => 24000sec => 6,66... hours


If you simply update your sleep parameter the result should be as expected.

if(!$available) {    $secondsToSleep = $hours[$hour]*60;    echo "\n Sleeping for ".$secondsToSleep;    sleep($secondsToSleep); //Sleep until the next request}