note 52043 added to function.fgets
| From: | dcanas at intnet dot co dot cr | Date: | Tue, 19 Apr 2005 23:15:26 +0000 |
| Subject: | note 52043 added to function.fgets | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88228@lists.php.net to get a copy of this message | ||
An easier way to read a file and eliminate unwanted carriage returna, line feeds... and avoids the
problem with reading an extra line.
$fhandle = fopen("file_name","r");
while ( ($line = fgets($fhandle)) != false ) {
$line = trim($line);
echo $line;
echo "\n";
}
----
Manual Page -- http://www.php.net/manual/en/function.fgets.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52043
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52043&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52043&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52043&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52043&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52043&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52043&report=yes
Search -- http://master.php.net/manage/user-notes.php