Syntax

Definition and Usage

Parameters

The optional parameter flags can be one, or more, of the following constants −

FILE_USE_INCLUDE_PATH − Search for the file in the include_path.

FILE_IGNORE_NEW_LINES − Do not add newline at the end of each array element.

FILE_SKIP_EMPTY_LINES − Skip empty lines.

FILE_TEXT − The content is returned in UTF-8 encoding. You can specify a different encoding by creating a custom context. This flag cannot be used with FILE_BINARY. This flag is only available since PHP 6.

FILE_BINARY − The content is read as binary data. This is the default setting and cannot be used with FILE_TEXT. This flag is only available since PHP 6.

3

context

A context resource created with the stream_context_create() function.

Return Value

It returns the file in an array. Each element of the array corresponds to a line in the file, with the newline still attached. Upon failure, file() returns FALSE.