Php Sleep

Php Sleep
  1. Php Delay

Note: The settimelimit function and the configuration directive maxexecutiontime only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using system, the sleep function, database queries, etc. Is not included when determining the maximum time that the script has been running. L-theanine is a natural compound that is present in green tea and black tea. In this article, we look at the potential health benefits and risks of L-theanine as well as its dosage.

Php SleepPhp SleepPhp sleep millisecondsSleep

Php Delay

We can create a delay by using sleep command inside our PHP script. This command sleep will delay the output by seconds specified in sleep command. Here is the syntax. The above command will create a delay of 25 seconds, the next step of execution will be after the delay of 25 seconds.
Some time while testing our scripts we need to add some delay , here it is useful. Say you want to see maximum script execution time of your server. This setting you can know by increasing the sleep time till the set value of execution time at server.
Let us print the time after a delay of 15 seconds.
Here we will first display the time in hour : minute : second format and then use the php flush command to send the output to browser. Then the sleep command will delay the execution by 15 seconds and then again we will print the server time to see the delay. Here is the code. Out of the two outpus , second one will return after 15 secs