prevent infinite loop, user notes

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@196175 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Friedhelm Betz 2005-09-16 11:13:44 +00:00
parent 955b704b8d
commit 31c352f875

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.13 $ -->
<!-- $Revision: 1.14 $ -->
<!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 -->
<refentry id="function.fgets">
<refnamediv>
@ -40,12 +40,14 @@
<programlisting role="php">
<![CDATA[
<?php
$handle = fopen("/tmp/inputfile.txt", "r");
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
echo $buffer;
$handle = @fopen("/tmp/inputfile.txt", "r");
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
echo $buffer;
}
fclose($handle);
}
fclose($handle);
?>
]]>
</programlisting>