Definition :
The PHP flock() function is used to lock or release a file. The lock is released also by fclose(), or when stream is garbage collected.
flock(file, lock, block)
Parameter | Description |
---|---|
file | Required. Specifies an open file to lock or release |
lock | Required. Specifies what kind of lock to use.
Possible values:
|
Given below example Lock and release a "demo.txt" file:
Output : flock() function example