This is an old revision of the document!


$filename = 'whatever';
 
$fh = @fopen($filename, 'r');
 
if ( ! $fh ) {
    throw new Exception("Failed to open ${filename}";
}
 
while ( ( $text = fgets($fh) ) !== false ) {
    echo $text;
}
 
fclose($fh);
  • snippets/php/fgets.1611690846.txt.gz
  • Last modified: 02-Feb-2025 16:12
  • (external edit)