<?php $myfile = fopen("BPQR_210910.txt", "r") or die("Unable to open file!"); // Output one line until end-of-file $members = array(); while(!feof($myfile)) { //echo fgets($myfile) . "<br>"; $members[] = fgets($myfile); } fclose($myfile); var_dump($members); $myfile1 = fopen("BPQR_210910.txt", "r") or die("Unable to open file!"); // Output one line until end-of-file while(!feof($myfile1)) { echo fgets($myfile1) . "<br>"; } fclose($myfile1); // (A) FILE TO ARRAY $array = file('BPQR_210910.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); ?>