Skip to content
Advertisement

How To Use setInterval in PHP?

I want to ask that how can i use php function again and again after some time automatically just like setInterval in Javascript. We set the time and it is on its job until the script is aborted or closed.

INDEX.PHP

JavaScript

And Wall_Updates() Function is defined here in FUNCTION.PHP

JavaScript

I want this Wall_Updates() function to fetch data from mysql again and again.So, It will be Updated.

Advertisement

Answer

For the record: I think it’s bad idea. But whatever 🙂

Try this code

JavaScript

Usage:

JavaScript

Or:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement