<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="directoryiterator.key" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>DirectoryIterator::key</refname>
  <refpurpose>Return the key for the current DirectoryIterator item</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="DirectoryIterator">
   <modifier>public</modifier> <type>mixed</type><methodname>DirectoryIterator::key</methodname>
   <void/>
  </methodsynopsis>

  <para>
   Get the key for the current <classname>DirectoryIterator</classname> item.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  &no.function.parameters;
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   The key for the current <classname>DirectoryIterator</classname> item as an &integer;.
  </para>
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <para>
   <informaltable>
    <tgroup cols="2">
     <thead>
      <row>
       <entry>&Version;</entry>
       <entry>&Description;</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>8.1.0</entry>
       <entry>
        When the iterator is uninitialized, an <classname>Error</classname> is
        thrown now. Previously, the method returned &false;.
       </entry>
      </row>
     </tbody>
    </tgroup>
   </informaltable>
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>A <methodname>DirectoryIterator::key</methodname> example</title>
    <programlisting role="php">
<![CDATA[
<?php
$dir = new DirectoryIterator(dirname(__FILE__));
foreach ($dir as $fileinfo) {
    if (!$fileinfo->isDot()) {
        echo $fileinfo->key() . " => " . $fileinfo->getFilename() . "\n";
    }
}
?>
]]>
    </programlisting>
    &example.outputs.similar;
    <screen>
<![CDATA[
0 => apple.jpg
1 => banana.jpg
2 => index.php
3 => pear.jpg
]]>
    </screen>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><methodname>DirectoryIterator::current</methodname></member>
    <member><methodname>DirectoryIterator::next</methodname></member>
    <member><methodname>DirectoryIterator::rewind</methodname></member>
    <member><methodname>DirectoryIterator::valid</methodname></member>
    <member><methodname>Iterator::key</methodname></member>
   </simplelist>
  </para>
 </refsect1>

</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
