In this article, you will learn How to use File Open or Read in PHP.

A method to open file in PHP fopen() function. This function provides you many options than the readfile() function. We can use the type of file with this function.

  • AJAX = Asynchronous JavaScript and XML
  • CSS = Cascading Style Sheets
  • HTML = Hyper Text Markup Language
  • PHP = PHP Hypertext Preprocessor
  • SQL = Structured Query Language
  • SVG = Scalable Vector Graphics
  • XML = EXtensible Markup Language



$myfile = fopen("file.txt", "r") or die("Unable to open file!");
echo fread($myfile,filesize("webdictionary.txt"));


Welcome to Hub of Tutorials