2 of 2
added a semilcolon to fix syntax error when cutting/pasting; added a commented out example line; fixed typo in comment
<?php
$fh = fopen('filename.txt','r');
while ($line = fgets($fh)) {
// <... Do your work with the line ...>
// echo($line);
}
fclose($fh);
?>
This will give you a line by line read.. read the notes at php.net/fgets regarding the end of line issues with Macs.
Payload
- 1.7k
- 1
- 10
- 6