March 23, 200917 yr I'm having a play with reading a txt file line by line. I've looked at the fgets() function and now I'm looking at the stream_get_line() function but I'm a bit confused. My txt file looks like: The Name; This is the description; I have some code that looks like: <?php //Script to read details of a file $myFile = "file/file.txt"; $fh = fopen($myFile, 'r'); $theData = stream_get_line($fh,4096,";"); fclose($fh); echo $theData; ?> This will return the first line of the txt file no problem. What if I now want to get the second line of data?
Create an account or sign in to comment