PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Is there a way with PHP to automatically call a function every x seconds and have it perform some functionality?
For a group project, we are developing a web-app that has a graph. The graph needs to be updated every x seconds automatically. Is there an elegant way to do this?
A hack way I can think of is calling a function and running it with WHILE(1) and having it sleep for x seconds and then perform some functionality. I'm sure this is terrible as it will waste unnecessary resources spinning.
Are you wanting to update the graph and then push the new graph to the browser? Aside from flash or JS, you could use a meta-refresh tag to reload the update script ever couple of seconds.