PHP is a server language. Each time someone accesses a PHP program on the server, it starts, regardless of who the client is.
So, imagine a program containing a counter. It stores this in a database. Each time updatecounter.php is called, the counter is updated one.
You are viewing updatecounter.php and it tells you that the counter is now 34.
The next time you go to updatecounter.php, it will tell you that the counter is 53.
He grew 18 more than expected.
This is because updatecounter.php is launched without your intervention. It was ruled by other people.
Now, if you looked at updatecounter.php, you can see the following code:
require_once("my_code.php); $counterValue = increment_counter_value(); echo "New Counter Value = ".$counterValue;
Please note that the main core of the program is stored in a separate program than the program you are calling.
Also, note that instead of calling increment_counter_value, you can call anything. Therefore, every time someone looked at updatecounter.php or whatever game you called, you could launch an internal game. For example, you can have an hourly charter management procedure that will check every time it is called, if it has been running in the last hour, and if it has not performed all the statistics.
Now, what if no one is playing your game? If this happens, then the hourly status management will not be called, and your game world will die. So, what you need to do is create another program whose only function is to run your statistics. Then you plan to run this program on the server at hourly intervals. You do this using something called CRON . You will probably find that your host is already built into this object if you are in Apache. I will no longer go into details about scheduling tasks, not knowing that your environment cannot give the correct answer. But basically, you need to plan to run the PHP program on the server to do hourly maintenance.
Here is a CRON assignment tutorial:
http://net.tutsplus.com/tutorials/other/scheduling-tasks-with-cron-jobs/
I did not use it myself, but I had no problems with other things on tutsplus, so you should be fine.