Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

file_get_contents()

3 tags 1 category

file_get_contents() — Reads entire file into a string.

This function is similar to file, except that file_get_contents returns the file in a string, starting at the specified offset up to length bytes. On failure, file_get_contents will return false.

file_get_contents is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance.

Inputs: filename: Name of the file to read. context: A valid context resource created with stream_context_create. If you don’t need to use a custom context, you can skip this parameter by null. offset: The offset where the reading starts on the original stream. Negative offsets count from the end of the stream. Seeking (offset) is not supported with remote files. Attempting to seek on non-local files may work with small offsets, but this is unpredictable because it works on the buffered stream. length: Maximum length of data read. The default is to read until end of file is reached. Note that this parameter is applied to the stream processed by the filters.

Returns: The function returns the read data or false on failure.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…