Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
snippets:php:fgets [26-Jan-2021 19:39] Steve Joyntsnippets:php:fgets [02-Feb-2025 16:14] (current) – external edit 127.0.0.1
Line 1: Line 1:
-<file>+<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> </file>
  • snippets/php/fgets.1611689986.txt.gz
  • Last modified: 02-Feb-2025 16:12
  • (external edit)