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