docs:programming:php:read_a_file_by_line

read a file by line

<?php
 
$filename = "/path/to/some/file";
 
$fh = fopen($filename, "r");
 
if( !$fh )
	exit("failed to open file\n");
 
while( $line = fgets($fh) )
	echo $line;
 
fclose($fh);
 
?>
  • docs/programming/php/read_a_file_by_line.txt
  • Last modified: 2009/02/09 22:14
  • by billh