hello, i'm just not too sure of what i understand may be true or not. Suppose that i open a txt file on the server and write to it using fwrite and this has to continue at any given rate of time though not always. Is there any chances of returning me a half written text (file_get_contents) in case a long polling session is imposed to it(like every second)? Or only after finished procesing the writings,will it return me any data? Thanks
I know that when a file is readen and written a lot at the same time, errors can occur. Therefor it's better to use databases in such cases.
what I can guess is you are trying to create sort of very very basic chat system or a shoutbox, that will consume a lot of resources, but as far your question, here goes the answer. $fsize = filesize('yourfile.txt'); $half = file_get_contents('yourfile.txt', 0, NULL, ceil($fsize/2) ); //reading second half, eq unix `tail` command Code (markup): I hope it helps your learning.