$zeit = time();
$zeit60 = time()+2;
while ($zeit < $zeit60){
sleep (1);
echo time();
}
why does this not work ?
Thanks for Answers!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your code will print the time every second… forever. Because the condition is essentially
while x < x+2, which is of course true ∀ x ∈ ℝYou probably should update the value of
$zeit, so that after the time expires your loop will exit.That said, unless you have particularly complex code, it may be sufficient to do the following: