mirror of
https://github.com/php/doc-de.git
synced 2026-03-26 16:22:10 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/de/trunk@84245 c90b9560-bf6c-de11-be94-00142212c4b1
120 lines
2.9 KiB
XML
120 lines
2.9 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.4 $ -->
|
|
<!-- EN-Revision: 1.4 Maintainer: tom Status: ready -->
|
|
<refentry id="function.array-keys">
|
|
<refnamediv>
|
|
<refname>array_keys</refname>
|
|
<refpurpose>Liefert alle Schlüssel eines Arrays</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Beschreibung</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_keys</methodname>
|
|
<methodparam><type>array</type><parameter>input</parameter></methodparam>
|
|
<methodparam choice="opt"><type>mixed</type><parameter>
|
|
search_value
|
|
</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>array_keys</function> gibt die Schlüssel (numerisch und
|
|
String) des Arrays <parameter>input</parameter> zurück.
|
|
</para>
|
|
<para>
|
|
Ist der optionale Parameter <parameter>search_value</parameter>
|
|
angegeben, werden nur die Schlüssel für diesen Wert zurückgegeben.
|
|
Andernfalls werden all Schlüssel von <parameter>input</parameter>
|
|
zurückgegeben.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>array_keys</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
$array = array (0 => 100, "Farbe" => "rot");
|
|
print_r(array_keys ($array));
|
|
|
|
$array = array ("blau", "rot", "grün", "blau", "blau");
|
|
print_r(array_keys ($array, "blau"));
|
|
|
|
$array = array ("Farbe" => array("blau", "rot", "grün"), "Größe" => array("klein", "mittel", "groß"));
|
|
print_r(array_keys ($array));
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
würde folgendes ausgeben:
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[0] => 0
|
|
[1] => Farbe
|
|
)
|
|
Array
|
|
(
|
|
[0] => 0
|
|
[1] => 3
|
|
[2] => 4
|
|
)
|
|
Array
|
|
(
|
|
[0] => Farbe
|
|
[1] => Größe
|
|
)
|
|
]]>
|
|
</screen>
|
|
</para>
|
|
</example>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Diese Funktion wurde in PHP 4 eingeführt, nachstehend finden Sie eine
|
|
Implementierung für Benutzer von PHP 3.
|
|
<example>
|
|
<title>
|
|
Implementierung von <function>array_keys</function> für
|
|
Benutzer von PHP 3:
|
|
</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
function array_keys ($arr, $term="") {
|
|
$t = array();
|
|
while (list($k,$v) = each($arr)) {
|
|
if ($term && $v != $term) {
|
|
continue;
|
|
}
|
|
$t[] = $k;
|
|
}
|
|
return $t;
|
|
}
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</note>
|
|
<para>
|
|
Siehe auch <function>array_values</function>.
|
|
</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:"../../../../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
|
|
-->
|