Time-Loopings

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Tubbietoeter
Forum Contributor
Posts: 149
Joined: Fri Mar 14, 2003 2:41 am
Location: Germany

Time-Loopings

Post by Tubbietoeter »

Hi guys,


I got a function that checks on a status. It must loop until $flag=="true".

Code: Select all

$flag="false";
  while (flag=="false") {
    if (check_is_okay()) {
          $flag="true";
    } else {
         do_something_else();
    }
  }
Since I know it will take some time I want to loop the function in a 5 second interval or something like that.

Has anyone a hint on how to do that?
ik
Forum Commoner
Posts: 34
Joined: Thu Jul 10, 2003 5:33 am
Location: Lancs Uni, UK
Contact:

Post by ik »

Hi!
Try to use register_tick() instead of loop.
Tubbietoeter
Forum Contributor
Posts: 149
Joined: Fri Mar 14, 2003 2:41 am
Location: Germany

Post by Tubbietoeter »

uh, i dont think this will work for me? if a tick is something like a process counter ... well the loop is the only thing that is to be executed at this point of the script.
ik
Forum Commoner
Posts: 34
Joined: Thu Jul 10, 2003 5:33 am
Location: Lancs Uni, UK
Contact:

Post by ik »

ups.... Sorry :(
I oriented by name (tick!) an thought it's a timer callback, as usual.
Tubbietoeter
Forum Contributor
Posts: 149
Joined: Fri Mar 14, 2003 2:41 am
Location: Germany

Post by Tubbietoeter »

ah got it!!

what i need is the sleep-function ... thanks anyways ... ;o)
Post Reply