The following code opens a file and displays the first line only.
This is quite handy, but I need to display up to 10 lines.
Does the fgets() function allow for this, or will I need to create a while() loop?
php.net specifies I can add the second argument of byte size, but I thought I'd ask if there was a way to do what I need without a while() statment.
$file = fopen("myfile.txt","r");
if($file){
echo fgets($file); // shows first line only
fclose($file);
}