Gen. partnerAlgotech

PHP function fgets()

Gets line from file pointer

|
September 11, 2019

Availability in PHP 4.0

Gets line from file pointer

Parameters

Parameter Data type Default value Note
$handle resource not
$length int null 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, it will keep reading from the stream until it reaches the end of the line.

Return values

string

a string of up to length - 1 bytes read from the file pointed to by handle.

If an error occurs, returns false.

Additional resources

Official fgets documentation

Loading comments...

Stay in the loop

Subscribe to our newsletter and get the latest cybersecurity news delivered straight to your inbox.

Your data is safe. You can unsubscribe from the newsletter at any time.