Yes, you can use a flat file. But note that, while flat files can often be better than a database, they are usually slower.
There are several functions you can use. [man]file/man is easy, but slow, and memory inefficient. [man]fopen/man is the best way to open a file, but requires that you sift through it with [man]fread/man (or [man]fgets/man), and then write to it with [man]fwrite/man or [man]fputs/man.
You can also read through with [man]file_get_contents/man, and, if you have PHP5, write with [man]file_put_contents/man.