Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
snippets:php:fgets [26-Jan-2021 19:24] – created Steve Joyntsnippets:php:fgets [02-Feb-2025 16:14] (current) – external edit 127.0.0.1
Line 1: Line 1:
-hello+<file php> 
 + 
 +$filename = 'whatever'; 
 +  
 +$fh = @fopen($filename, 'r'); 
 + 
 +if ( ! $fh ) { 
 +    throw new Exception("Failed to open ${filename}"); 
 +
 + 
 +while ( ( $text = fgets($fh) ) !== false ) { 
 +    echo $text; 
 +
 + 
 +</file>
  • snippets/php/fgets.1611689080.txt.gz
  • Last modified: 02-Feb-2025 16:12
  • (external edit)