<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Gets line from stream resource up to a given delimiter</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.stream-get-filters.html">stream_get_filters</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.stream-get-meta-data.html">stream_get_meta_data</a></div> <div class="up"><a href="ref.stream.html">Stream Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.stream-get-line" class="refentry"> <div class="refnamediv"> <h1 class="refname">stream_get_line</h1> <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">stream_get_line</span> — <span class="dc-title">Gets line from stream resource up to a given delimiter</span></p> </div> <div class="refsect1 description" id="refsect1-function.stream-get-line-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><strong>stream_get_line</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$handle</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code></span> [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$ending</code></span> ] )</div> <p class="para rdfs-comment"> Gets a line from the given handle. </p> <p class="para"> Reading ends when <em><code class="parameter">length</code></em> bytes have been read, when the string specified by <em><code class="parameter">ending</code></em> is found (which is <em class="emphasis">not</em> included in the return value), or on <acronym title="End Of File">EOF</acronym> (whichever comes first). </p> <p class="para"> This function is nearly identical to <span class="function"><a href="function.fgets.html" class="function">fgets()</a></span> except in that it allows end of line delimiters other than the standard \n, \r, and \r\n, and does <em class="emphasis">not</em> return the delimiter itself. </p> </div> <div class="refsect1 parameters" id="refsect1-function.stream-get-line-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">handle</code></em></span> <dd> <p class="para"> A valid file handle. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">length</code></em></span> <dd> <p class="para"> The number of bytes to read from the handle. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">ending</code></em></span> <dd> <p class="para"> An optional string delimiter. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.stream-get-line-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns a string of up to <em><code class="parameter">length</code></em> bytes read from the file pointed to by <em><code class="parameter">handle</code></em>. </p> <p class="para"> If an error occurs, returns <strong><code>FALSE</code></strong>. </p> </div> <div class="refsect1 seealso" id="refsect1-function.stream-get-line-seealso"> <h3 class="title">See Also</h3> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.fread.html" class="function" rel="rdfs-seeAlso">fread()</a> - Binary-safe file read</span></li> <li class="member"> <span class="function"><a href="function.fgets.html" class="function" rel="rdfs-seeAlso">fgets()</a> - Gets line from file pointer</span></li> <li class="member"> <span class="function"><a href="function.fgetc.html" class="function" rel="rdfs-seeAlso">fgetc()</a> - Gets character from file pointer</span></li> </ul> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.stream-get-filters.html">stream_get_filters</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.stream-get-meta-data.html">stream_get_meta_data</a></div> <div class="up"><a href="ref.stream.html">Stream Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>