In this tutorial you will use PHP to create our own counter. Given that not everyone has access to a database, this tutorial will save the hits to a .dat file.
This example is very basic and far from ideal if you want an accurate count of your visitors because if you press refresh your counter will always increment by 1. This example does show some useful techniques such as opening and closing files .