Answers for "php read big file line by line"

PHP
0

php read big file line by line

if ($file = fopen("file.txt", "r")) {
    while(!feof($file)) {
        $line = fgets($file);
        # do same stuff with the $line
    }
    fclose($file);
}
Posted by: Guest on September-09-2021
0

php read big file line by line

$handle = fopen("inputfile.txt", "r");
if ($handle) {
    while (($line = fgets($handle)) !== false) {
        // process the line read.
    }

    fclose($handle);
} else {
    // error opening the file.
}
Posted by: Guest on September-09-2021

Code answers related to "php read big file line by line"

Browse Popular Code Answers by Language