I have a php file test.php. I want to echo or print "Success" after 5 seconds, soon after the php file is called or loaded or opened by the browser. Incidentally, sometimes I may want to execute / initialise some functions after a specific interval of time.
How can I make a time-oriented task using php, like printing a message after 5 seconds?
You can interrupt the execution of your script using
sleep(). If you want sub-second precision, you can useusleep():