Reading a File in PHP

readfile("filename") function in PHP reads the content in any file.

Source code :


echo readfile("myfile.txt"); // it can be any file with extension 


Output :

CodeCry is a Code Repository comprised of codes from C, C++, Java, Python and many others.

Notes :

Reading the contents in a file using PHP is quite simpler than any other languages.

readfile() -Reads a file.
fopen() - Opens a file .
fsockopen() - Open Internet connection.
file_get_contents() - Reads entire file into a string.

Output :


Comments :