top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How Data of a file can be read in the form of single string?

0 votes
350 views
How Data of a file can be read in the form of single string?
posted Jun 16, 2014 by Amanpreet Kaur

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

file_get_contents() is the 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.
Syntax:
string file_get_contents ( string $filename [, bool $use_include_path = false [, resource $context [, int $offset = -1 [, int $maxlen ]]]] )
This function is similar to file(), except that file_get_contents() returns the file in a string, starting at the specified offset upto maxlen bytes.On failure, file_get_contents() will return FALSE.

answer Jun 18, 2014 by Rahul Mahajan
...