I have a counter which I increment every page visit. I do not want to keep this value in DB or in plain file. Is there any other approach to keep it?
I need keep it for next visit. In the next visit I want to read it, increase and keep again.
Why I do not want to use DB? Because in whole project I'm not using DB it's simple project.
Plain file it's maybe the easiest solution. And every concurrency access can be solved by PHP. But maybe is there anything easier and lightweight than plain file (in performance sense ?
If you do not want to use database, next easy way is - as you wrote - use single file like
counter.txt
which will contains only an integer value.
Then open file, read value, increase, write, close. It will be quite fast operation.
That solution was used before databases became popular.