Sometimes you need to temporarily halt the code execution of your PHP script for certain seconds and then automatically resume it. For example, some mail delivery servers have the restriction that you have to wait a certain interval such as 12 seconds before sending another email.
You can tell your PHP script to stop for 12 seconds before continuing down with the rest of the code by sleep() function:
sleep(12); // freeze PHP execution for 12 seconds before going ahead
That’s it. When it is executed to this line, PHP will freeze for 12 seconds, doing nothing, and then go on with the line immediately after this line.