<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.splfileobject.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'splfileobject.seek.php',
    1 => 'SplFileObject::seek',
    2 => 'Seek to specified line',
  ),
  'up' => 
  array (
    0 => 'class.splfileobject.php',
    1 => 'SplFileObject',
  ),
  'prev' => 
  array (
    0 => 'splfileobject.rewind.php',
    1 => 'SplFileObject::rewind',
  ),
  'next' => 
  array (
    0 => 'splfileobject.setcsvcontrol.php',
    1 => 'SplFileObject::setCsvControl',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/spl/splfileobject/seek.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="splfileobject.seek" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SplFileObject::seek</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">SplFileObject::seek</span> &mdash; <span class="dc-title">Seek to specified line</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-splfileobject.seek-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>SplFileObject::seek</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$line</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

  <p class="para rdfs-comment">
   Seek to specified line in the file.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-splfileobject.seek-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">line</code></dt>
     <dd>
      <p class="para">
       The zero-based line number to seek to.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-splfileobject.seek-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   No value is returned.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-splfileobject.seek-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   Throws a <span class="classname"><a href="class.logicexception.php" class="classname">LogicException</a></span> if the 
   <code class="parameter">line</code> is negative.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-splfileobject.seek-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 <span class="methodname"><strong>SplFileObject::seek()</strong></span> example</strong></p>
    <div class="example-contents"><p>This example outputs the third line of the script which is found at position 2.</p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$file </span><span style="color: #007700">= new </span><span style="color: #0000BB">SplFileObject</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$file</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">seek</span><span style="color: #007700">(</span><span style="color: #0000BB">2</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">$file</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">current</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>The above example will output
something similar to:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">$file-&gt;seek(2);</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-splfileobject.seek-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="splfileobject.current.php" class="methodname" rel="rdfs-seeAlso">SplFileObject::current()</a> - Retrieve current line of file</span></li>
    <li><span class="methodname"><a href="splfileobject.key.php" class="methodname" rel="rdfs-seeAlso">SplFileObject::key()</a> - Get line number</span></li>
    <li><span class="methodname"><a href="splfileobject.next.php" class="methodname" rel="rdfs-seeAlso">SplFileObject::next()</a> - Read next line</span></li>
    <li><span class="methodname"><a href="splfileobject.rewind.php" class="methodname" rel="rdfs-seeAlso">SplFileObject::rewind()</a> - Rewind the file to the first line</span></li>
    <li><span class="methodname"><a href="splfileobject.valid.php" class="methodname" rel="rdfs-seeAlso">SplFileObject::valid()</a> - Not at EOF</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>