1/*
2In php to read file first you have to use 'fopen' method to open the file after that you perform different operation on it.
3Like Reading file, Writing file etc.
4
5TO read file data we have to use 'fread' method.
6*/
7
8<?php
9$myfile = fopen("read_text_file.txt", "r") or die("Unable to open file!");
10echo fread($myfile,filesize("read_text_file.txt"));
11fclose($myfile);
12?>
13
14/*
15I hope it will help you.
16Namaste
17Stay Home Stay Safe
18*/
1<?php
2
3$fh = fopen('filename.txt','r');
4while ($line = fgets($fh)) {
5 // <... Do your work with the line ...>
6 // echo($line);
7}
8fclose($fh);
9?>