HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Read a file into an array
The file() reads a file into an array.
Each array element contains a line from the file, with the newline character still attached.
Parameter | Description |
---|---|
filename | Required. Specifies the path to the file to read |
flag |
Optional. Can be one or more of the following constants:
|
context | Optional. Specifies the context of the file handle. Context is a set of options that can modify the behavior of a stream. Can be skipped by using NULL. |
Return Value: | The entire file in an array, FALSE on failure |
---|---|
PHP Version: | 4.0+ |
Binary Safe: | Yes, in PHP 4.3 |
❮ PHP Filesystem Reference