PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi all, i am new with PHP, and i would like to know if it is possible to use one file by two different functions at the same time. That is, one function will read information from the top of the file, while second function will add information on the bottom of the file. Second function is much faster in its job so ther is no problem that first function will come to the end of the file before second function finish its work.
Is this possible, or i need to break the file into more files that will be approached by only one function at the time?
I dont think you can do that simultaniously, but you can use file() to get the file into an array (each line in each index of the array), then close the file, and then write to it while reading from the array.
Yes, idea is to fork these two processes. Problem is that i dont know if it is possible for these two programs to use same file at same time, one to write to file, one to read from the file.