mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Improve example for fgets() (Fixes #52721) -- Patch by mmailnew4ster at gmail dot com
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@304499 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
a2fd88079f
commit
c1e01bb991
1 changed files with 4 additions and 2 deletions
|
@ -102,10 +102,12 @@
|
|||
<?php
|
||||
$handle = @fopen("/tmp/inputfile.txt", "r");
|
||||
if ($handle) {
|
||||
while (!feof($handle)) {
|
||||
$buffer = fgets($handle, 4096);
|
||||
while (($buffer = fgets($handle, 4096)) !== false) {
|
||||
echo $buffer;
|
||||
}
|
||||
if (!feof($handle)) {
|
||||
echo "Error: unexpected fgets() fail\n";
|
||||
}
|
||||
fclose($handle);
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue