-
[PHP]Loop Delay
Errr I been googlin found nothin thats helped me -.-'
Heres what I have so far. Im tryin to attempt to make a working clock for my website im using to test on.
PHP Code:
<?php
$fh = fopen("time.php", 'r');
$time = fread($fh, filesize("time.php"));
fclose($fh);
echo $time;
function setTime() {
$time = $time + 1;
$fh = fopen("time.php", 'w');
$data = $time;
fwrite($fh, $data);
fclose($fh);
}
while($time == $time) {
setTime();
sleep(60000);
}
?>
Eventually ill add ifs for hours and minutes but atm when the sleep kicks in it dont let my website load.... If anyone could push me in the right direction where i went wrong would help alot, thanks
-
Re: [PHP]Loop Delay
You know 60,000 milliseconds equal 60 seconds...
-
Re: [PHP]Loop Delay
yeah, im makin a, well basically clock, every 60 seconds it will add +1 minute
-
Re: [PHP]Loop Delay
-
Re: [PHP]Loop Delay
meh SOB that could be why the stupid thing took so long, -.- confusing, c++ sleep goes by millseconds, php it goes by seconds, sorry for this post thanks king izu.
-
Re: [PHP]Loop Delay
usleep() is in microseconds.