PHP定时器的功能

http://ejohn.org/blog/how-javascript-timers-work/

Javascript has timers for functions, is there something similar in PHP as well. In my script, I want one function to run every 50 seconds, and then continuing the script as it is. Is this possible ?

More information : At the start of the PHP script, via an API I generate a session ID which expires every 60 seconds. We can renew that in 60 seconds. So, what I want is, every 50 seconds, a function runs which will renew that session ID with a curl request and then again continue the PHP script, so that I can retrieve images from the web-server I want. Also, I want to run it from console(infinite running script) and not as a server-side language.

PHP runs on the server level - before the page is sent to the browser. If you want something to run every 50 seconds after the page loads then you have to do it using javascript. You can however invoke a php script every 50 seconds using a javascript timer and an ajax call to the script. Is this what you need to do?

Here is a good way to do it.