Answers for "php get line from file"

PHP
3

php read 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 May-22-2020
1

read line by line php

<?php
	
	$file = new SplFileObject("file.txt");

	while(!$file->eof())
	  {
		echo $file->fgets()."<br/>";
	  }

	$file = null;

?>
Posted by: Guest on December-25-2020

Browse Popular Code Answers by Language