Name

sleep()

Synopsis

    int sleep ( int seconds )

The sleep() function pauses execution for a set number of seconds, determined by the parameter you provide it. For example:

    sleep(4);
    echo "Done\n";

The maximum script execution time is 30 seconds by default (although you may have changed this by altering the max_execution_time setting inside php.ini), but you can use sleep() to make your scripts go on for longer than that because PHP does not have control during the sleep operation.

Get PHP in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.