Re: Output Control
| From: | Jason Barnett | Date: | Thu, 27 May 2004 18:59:40 +0000 |
| Subject: | Re: Output Control | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-23869@lists.php.net to get a copy of this message | ||
When PHP is used to serve pages it won't output anything until it is completely finished with execution. If you're trying to show 10 numbers with a one second delay you'd probably need to use refresh tags and a hidden field (or sessions) to loop back to the same page with each "second". I.e.
<?php
error_reporting(E_ALL);
session_start();
$time = &$_SESSION['time'];
$time++;
$delay = 1;
$wait = 10;
if ($time < $wait) {
echo "<meta http-equiv=\"refresh\" content=\"$delay\";url=\"{$_SERVER['PHP_SELF']}\">";
echo "<form><input type=\"hidden\" name=\"time\" value=\"$time\">$time</form>";
}
?>