PHP: while (time() < time()+2;){ echo "why does this not work ?"}; -
PHP: while (time() < time()+2;){ echo "why does this not work ?"}; -
$zeit = time(); $zeit60 = time()+2; while ($zeit < $zeit60){ sleep (1); echo time(); }
why not work ?
thanks answers!
your code print time every second... forever. because status while x < x+2, of course of study true ∀ x ∈ ℝ
you should update value of $zeit, after time expires loop exit.
that said, unless have particularly complex code, may sufficient following:
$seconds = 2; while($seconds) { sleep(1); echo time(); $seconds--; } php time while-loop
Comments
Post a Comment