![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|||||||||||
fgetsDescriptionstring fgets ( resource handle [, int length] )Returns a string of up to length - 1 bytes read from the file pointed to by handle. Reading ends when length - 1 bytes have been read, on a newline (which is included in the return value), or on EOF (whichever comes first). If no length is specified, the length defaults to 1k, or 1024 bytes. If an error occurs, returns FALSE. Common Pitfalls: People used to the 'C' semantics of fgets() should note the difference in how EOF is returned. The file pointer must be valid, and must point to a file successfully opened by fopen() or fsockopen(). A simple example follows:
See also fread(), fgetc(), stream_get_line(), fopen(), popen(), fsockopen(), and stream_set_timeout(). Copyright © 1997 - 2007 by the PHP Documentation Group. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later. A copy of the Open Publication License is distributed with this manual, the latest version is presently available at http://www.opencontent.org/openpub/. Please see full copyright text at http://www.php.net/manual/en/copyright.php Original version of the above documentation is available at http://www.php.net/manual/en/ |
|