PHP Terms Files

 

- Info:

- This tutoril contains list of flags used for operating on files

- This tutorial is based on:

- http://www.php.net/fopen

- http://www.onlamp.com/pub/a/php/2002/12/12/php_foundations.html

 

- Text/Binary Files:

  

Text

Binary

Description

 

r

rb

Open a file for read only use.

If file doesn't exists error is returned.

The file pointer begins at the front of the file.

 

w

wb

Open file for writing.

If file exists data is deleted.

If file doesn't exists new one is created.

The file pointer begins at the front of the file.

 

a

ab

Open file for writing.

If file exists data is appended to the end of the file.

If file doesn't exists new one is created.

The file pointer begins at the end of the file.

 

r+

r+b

Open a file for reading and writing.

If file doesn't exist new one is created.

If file exists content is preserved.

File pointer is at the begining of the file.

 

w+

w+b

Open file for reading and writing.

If file exists data is deleted.

If file doesn't exists new one is created.

The file pointer begins at the front of the file.