PHP TUTORIALS - PHP Files & I/O
PHP Files & I/O
ADVERTISEMENTS
Opening and Closing Files
Mode | Purpose |
---|---|
r |
Opens the file for reading only. Places the file pointer at the beginning of the file. |
r+ |
Opens the file for reading and writing. Places the file pointer at the beginning of the file. |
w |
Opens the file for writing only. Places the file pointer at the beginning of the file. and truncates the file to zero length. If files does not exist then it attemts to create a file. |
w+ |
Opens the file for reading and writing only. Places the file pointer at the beginning of the file. and truncates the file to zero length. If files does not exist then it attemts to create a file. |
a |
Opens the file for writing only. Places the file pointer at the end of the file. If files does not exist then it attemts to create a file. |
a+ |
Opens the file for reading and writing only. Places the file pointer at the end of the file. If files does not exist then it attemts to create a file. |
ADVERTISEMENTS
Reading a file
|
ADVERTISEMENTS
Writing a file
|