PHP Function Stream_Get_Line
php function stream_get_line is one of the most commonly used stream functions. Its main purpose is to read a line from an already open stream resource and return it as a string. The resulting string is limited to the length of the buffer and starts at the offset specified in the second argument. Reading stops when the string with a delimiter is found (which is not included in the returned string), when a newline is encountered or on EOF.
Streams are the way that PHP generalizes file, network, data compression and other types of operations that have traditionally been done on a per-file basis. In simplest terms, a stream is a streamable resource object that can be read from or written to in linear fashion and may have fseek() capabilities. Typically, a stream can be backed by a temporary memory stream or a disk-backed file system resource.
The most commonly used streams are php://stdin, php://stdout and php://php_temp (which is read-write). Other examples include a web server’s incoming requests and output, and ZIP files.
In addition to the core stream functions, the php library provides stream_wrapper_register() which allows developers to add their own protocol handlers and streams. The methods of a wrapper are then called when a stream is opened via fopen() or fread(). Using the library to handle your own stream types will allow you to get even more out of PHP by providing features which aren’t available in the standard API.