Hallo Dear Members,
I have one file. I want to read only the first three or four lines of this file. Is there any PHP script to do so. I need immediate help.
Thank you in advance,
Solomon
<? $file = "inputfile.txt"; $limit = 4; // # lines to read $cnt = 0; $fp = fopen($file,"r"); while (!feof($fp) && $cnt < $limit) { $cnt++; print $cnt.". ".fgets($fp, 4096)."<br>\n"; } fclose($fp);