The documentation for file_put_contents () states the following:
FILE_APPEND
Mutual exclusions with LOCK_EX from the application are atomic and, therefore, there is no reason to lock.
LOCK_EX
Mutual exception using FILE_APPEND.
However, a few lines below I see the following code:
<?php
$file = 'people.txt';
$person = "John Smith\n";
file_put_contents($file, $person, FILE_APPEND | LOCK_EX);
?>
So, are the FILE_APPEND and LOCK_EX flags mutually exclusive or not? If so, why do they use it in the example? Is this bad documentation?
Thanks for your input!
source
share