I'm using:
file_put_contents("peopleList.txt", $person, FILE_APPEND | LOCK_EX);
To write to the end of a file and to make sure no one else (or script) is also writing to the same file at the same time.
The PHP manual says it will return a falsy value if unsuccessful.
If it cannot obtain a lock on the file, will it fail, or keep trying until it can? If it does fail when no lock can be obtained, what would be the best way to go about ensuring the data is written?
Perhaps looping the function in a while loop until it does not return false (cringe) or simply providing the user (website visiter) with some kind of GUI requesting they try again?