Easy Tutorial
❮ Func Array Push Func Zip Entry Name ❯

PHP file() Function



Definition and Usage

The file() function reads an entire file into an array.

Each element of the array corresponds to a line in the file, including the newline character.

Syntax

Parameter Description
path Required. Specifies the file to read.
include_path Optional. Set this parameter to '1' if you want to search for the file in the include_path (specified in php.ini).
context Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream. If NULL, it is ignored.

Tips and Notes

Tip: Starting from PHP 4.3, this function is binary-safe. (This means both binary data, such as images, and character data can be written using this function.)


Example

The above code will output:


❮ Func Array Push Func Zip Entry Name ❯