shothilt.blogg.se

Php sleep parameter has to be long
Php sleep parameter has to be long









php sleep parameter has to be long

$SECONDS should be a positive integer number of seconds the script should be paused for.The syntax for the PHP sleep() function is as follows: sleep($SECONDS) The sleep() and usleep() functions should be used with caution to make sure you don’t cause your PHP app to freeze up for too long, especially if there’s a user at the other end waiting for content to load.īoth of the below functions can be safely used in PHP on the command line as well as in web environments. Again, a loop would be constructed which contains code checking for a response, condition, or resource to become available, with a call to the sleep() function at the end so that it will wait a few seconds before trying again. The sleep() function may also be used to wait for a certain condition to be met or resource to become available. A call to the sleep( ) function might be placed at the end of a loop, so that after the code inside the loop has been run, a certain amount of time passes before the loop executes again. Why Pause/Sleep PHP Script Execution?ĭelaying, sleeping, or pausing PHP script execution is commonly used when scheduling an event. The PHP sleep() and usleep() functions both pause execution of the script, but both behave a bit differently.

Php sleep parameter has to be long how to#

This short tutorial will show you how to use the PHP sleep() and usleep() functions to pause script execution for a number of seconds/microseconds, and provide some code examples.











Php sleep parameter has to be long