<!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>Seeks to specific location in a stream</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="streamwrapper.stream-read.html">streamWrapper::stream_read</a></div> <div class="next" style="text-align: right; float: right;"><a href="streamwrapper.stream-set-option.html">streamWrapper::stream_set_option</a></div> <div class="up"><a href="class.streamwrapper.html">streamWrapper</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="streamwrapper.stream-seek" class="refentry"> <div class="refnamediv"> <h1 class="refname">streamWrapper::stream_seek</h1> <p class="verinfo">(PHP 4 >= 4.3.2, PHP 5)</p><p class="refpurpose"><span class="refname">streamWrapper::stream_seek</span> — <span class="dc-title">Seeks to specific location in a stream</span></p> </div> <div class="refsect1 description" id="refsect1-streamwrapper.stream-seek-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><strong>streamWrapper::stream_seek</strong></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$offset</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$whence</code> <span class="initializer"> = SEEK_SET</span></span> )</div> <p class="para rdfs-comment"> This method is called in response to <span class="function"><a href="function.fseek.html" class="function">fseek()</a></span>. </p> <p class="para"> The read/write position of the stream should be updated according to the <em><code class="parameter">offset</code></em> and <em><code class="parameter">whence</code></em>. </p> </div> <div class="refsect1 parameters" id="refsect1-streamwrapper.stream-seek-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">offset</code></em></span> <dd> <p class="para"> The stream offset to seek to. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">whence</code></em></span> <dd> <p class="para"> Possible values: <ul class="simplelist"> <li class="member"><strong><code>SEEK_SET</code></strong> - Set position equal to <em><code class="parameter">offset</code></em> bytes.</li> <li class="member"><strong><code>SEEK_CUR</code></strong> - Set position to current location plus <em><code class="parameter">offset</code></em>.</li> <li class="member"><strong><code>SEEK_END</code></strong> - Set position to end-of-file plus <em><code class="parameter">offset</code></em>.</li> </ul> </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-streamwrapper.stream-seek-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Return <strong><code>TRUE</code></strong> if the position was updated, <strong><code>FALSE</code></strong> otherwise. </p> </div> <div class="refsect1 notes" id="refsect1-streamwrapper.stream-seek-notes"> <h3 class="title">Notes</h3> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> If not implemented, <strong><code>FALSE</code></strong> is assumed as the return value. </p> </p></blockquote> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> Upon success, <span class="methodname"><a href="streamwrapper.stream-tell.html" class="methodname">streamWrapper::stream_tell()</a></span> is called directly after calling <span class="methodname"><strong>streamWrapper::stream_seek()</strong></span>. If <span class="methodname"><a href="streamwrapper.stream-tell.html" class="methodname">streamWrapper::stream_tell()</a></span> fails, the return value to the caller function will be set to <strong><code>FALSE</code></strong> </p> </p></blockquote> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para"> Not all seeks operations on the stream will result in this function being called. PHP streams have read buffering enabled by default (see also <span class="function"><a href="function.stream-set-read-buffer.html" class="function">stream_set_read_buffer()</a></span>) and seeking may be done by merely moving the buffer pointer. </p> </p></blockquote> </div> <div class="refsect1 seealso" id="refsect1-streamwrapper.stream-seek-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.fseek.html" class="function" rel="rdfs-seeAlso">fseek()</a> - Seeks on a file pointer</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="streamwrapper.stream-read.html">streamWrapper::stream_read</a></div> <div class="next" style="text-align: right; float: right;"><a href="streamwrapper.stream-set-option.html">streamWrapper::stream_set_option</a></div> <div class="up"><a href="class.streamwrapper.html">streamWrapper</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>