(PHP 5, PHP 7)

stream_get_lineGets line from stream resource up to a given delimiter


stream_get_line ( resource $handle , int $length [, string $ending ] ) : string

Gets a line from the given handle.

Reading ends when length bytes have been read, when the string specified by ending is found (which is not included in the return value), or on EOF (whichever comes first).

This function is nearly identical to fgets() except in that it allows end of line delimiters other than the standard \n, \r, and \r\n, and does not return the delimiter itself.



A valid file handle.


The number of bytes to read from the handle.


An optional string delimiter.


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

If an error occurs, returns FALSE.

Siehe auch

  • fread() - Liest Binärdaten aus einer Datei
  • fgets() - Liest eine Zeile von der Position des Dateizeigers
  • fgetc() - Liest das Zeichen, auf welches der Dateizeiger zeigt