Is there a function, or simple script that will delay processing by seconds, or whatever time I need?

For example:


require('include/script1.php');

// wait 3 seconds to start the next script.......

require('include/script2.php');

// wait 3 seconds to start the next script.......

require('include/script3.php');


Any ideas?
-thanks!

    Well, there's [man]usleep[/man]... or you can create your own wrapper to pass "seconds" instead of "micro seconds"...

    <?php
    function mySleep($span=5)
    {
        $microspan = 1000000 * $span;
        usleep($microspan);
    }
    ?>

      I place this function between the scripts?

      Or is there anything more I need to know?

        Well, if you followed the link to the manual, it'll answer all your questions. But yes, jut put it between your include calls and each script will be included XX seconds after the execution of the previous script finishes.

        BE CAREFUL!! Remember that php has an execution time limit. So if you go past 30 seconds, you might be asking for trouble on some servers 🙂

          You're right about that! I need to do the obvious and read.

          Thanks for your candor, 🙂

          thanks again!

            ah yes.... why didn't I think of that?

              I think you ignored so it you could have fun making your own function 🙂

                Write a Reply...