datruesurfer
08-09-2005, 11:10 PM
I have been trying to use the sleep function to test somthing out with PHP and need some help. I want it to work like cPanel does when its creating accounts and text automatically appears on the screen while the script is running without refreshing the page (if that makes any sense at all ). For example:
CODE
<?php
$now = date('h:i:s');
echo "The time is $now . Sleeping for 10 seconds...";
sleep(10);
$later = date('h:i:s');
echo "After 10 seconds the time is $later";
?>
What I want to do is have the first echo call executed and display on the users browser, wait 10 seconds and display the second echo statement on the users browser rather than waiting 10 seconds for both to display on the browser.
Anyone know what I'm taliking about?
CODE
<?php
$now = date('h:i:s');
echo "The time is $now . Sleeping for 10 seconds...";
sleep(10);
$later = date('h:i:s');
echo "After 10 seconds the time is $later";
?>
What I want to do is have the first echo call executed and display on the users browser, wait 10 seconds and display the second echo statement on the users browser rather than waiting 10 seconds for both to display on the browser.
Anyone know what I'm taliking about?
