How do I delay a PHP script that writes to a text file and then reads from the same file long enough to make sure changes have been written before I attempt the read?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
@symcbean is correct. You need to first close the handle you are working on using fclose. Then open up the read connection. The way PHP works is that it won’t move to the next line until the previous line has completed operations. So if you are concerned with the read running after the write, then make sure that is where it is in the code. This is different from java and javaScript where triggers cause pieces of the code to run.