How to change file contents in PHP ?

Posted by Misha Moroshko on Stack Overflow See other posts from Stack Overflow or by Misha Moroshko
Published on 2010-06-14T05:49:37Z Indexed on 2010/06/14 6:02 UTC
Read the original article Hit count: 189

Filed under:
|

I save in a file some info about users (like number of times user passed the login page, last visited time, and so on).

I want to read this info from the file, and update it (add 1 to the counter, and change the last visited time).

My question is: can I do it without opening the file twice ?

I open the first time to read the contents, and then open it again to overwrite the contents with the updated ones.

Thanks !

© Stack Overflow or respective owner

Related posts about php

Related posts about files