I have a code at the moment that prints all the lines from a text document and sparates the with delimeters.
$fp = fopen('TEXT_FILE','r');
if (!$fp) {echo 'File Doesn\'t Exist'; exit;}
while (!feof($fp)) {
$line = fgets($fp, 1024);
list ($field1, $field2, $field3) = split ('\|', $line);
echo '
<p>'.$field1.'</p>
<p>'.$field2.'</p>
<p>'.$field3.'</p>
</div>
';
++$fp;
}
fclose($fp);
Can someone tell me how to make it so that it only loops a certain number of times (say $max amount of times) and thus only displaying the first $max number of lines?
I’ve tried several different methods myself, all of which don’t work