<?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 => 'de',
  ),
  'this' => 
  array (
    0 => 'splfileobject.fgets.php',
    1 => 'SplFileObject::fgets',
    2 => 'Gets line from file',
  ),
  'up' => 
  array (
    0 => 'class.splfileobject.php',
    1 => 'SplFileObject',
  ),
  'prev' => 
  array (
    0 => 'splfileobject.fgetcsv.php',
    1 => 'SplFileObject::fgetcsv',
  ),
  'next' => 
  array (
    0 => 'splfileobject.fgetss.php',
    1 => 'SplFileObject::fgetss',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/spl/splfileobject/fgets.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

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

 </div>

 <div class="refsect1 description" id="refsect1-splfileobject.fgets-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>SplFileObject::fgets</strong></span>(): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Gets a line from the file.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-splfileobject.fgets-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">Diese Funktion besitzt keine Parameter.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-splfileobject.fgets-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Returns a string containing the next line from the file.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-splfileobject.fgets-errors">
  <h3 class="title">Fehler/Exceptions</h3>
  <p class="para">
   Throws a <span class="classname"><a href="class.runtimeexception.php" class="classname">RuntimeException</a></span> if the file cannot be read.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-splfileobject.fgets-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 <span class="methodname"><strong>SplFileObject::fgets()</strong></span> example</strong></p>
    <div class="example-contents"><p>This example simply outputs the contents of <code class="literal">file.txt</code> line-by-line.</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: #DD0000">"file.txt"</span><span style="color: #007700">);<br />while (!</span><span style="color: #0000BB">$file</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">eof</span><span style="color: #007700">()) {<br />    echo </span><span style="color: #0000BB">$file</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">fgets</span><span style="color: #007700">();<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-splfileobject.fgets-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.fgets.php" class="function" rel="rdfs-seeAlso">fgets()</a> - Liest die Zeile von der Position des Dateizeigers</span></li>
    <li><span class="methodname"><a href="splfileobject.fgetss.php" class="methodname" rel="rdfs-seeAlso">SplFileObject::fgetss()</a> - Gets line from file and strip HTML tags</span></li>
    <li><span class="methodname"><a href="splfileobject.fgetc.php" class="methodname" rel="rdfs-seeAlso">SplFileObject::fgetc()</a> - Gets character from file</span></li>
    <li><span class="methodname"><a href="splfileobject.current.php" class="methodname" rel="rdfs-seeAlso">SplFileObject::current()</a> - Retrieve current line of file</span></li>
   </ul>
  </p>
 </div>


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