<?php $myfile = fopen("BPQR_210705.txt", "r") or die("Unable to open file!"); // Output one line until end-of-file while(!feof($myfile)) { echo fgets($myfile) . "<br>"; } fclose($myfile); // (A) FILE TO ARRAY $array = file('BPQR_210705.txt'); echo count($array); echo count($array,1); print_r($array); // (B) ADDITIONAL OPTION - SKIP EMPTY LINES $array = file('BPQR_210705.txt', FILE_SKIP_EMPTY_LINES); print_r($array); ?>