mirror of
https://github.com/php/doc-de.git
synced 2026-03-26 08:12:07 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/de/trunk@261299 c90b9560-bf6c-de11-be94-00142212c4b1
94 lines
3.0 KiB
XML
94 lines
3.0 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.11 $ -->
|
|
<!-- EN-Revision: 1.11 Maintainer: nobody Status: ready -->
|
|
<!-- CREDITS: tom -->
|
|
<refentry xml:id="function.array-search" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>array_search</refname>
|
|
<refpurpose>Durchsucht ein Array nach einem Wert liefert bei Erfolg den
|
|
Schlüssel</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>array_search</methodname>
|
|
<methodparam><type>mixed</type><parameter>needle</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>haystack</parameter></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>strict</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Diese Funktion durchsucht <parameter>haystack</parameter> nach
|
|
<parameter>needle</parameter> und gibt bei Erfolg den Schlüssel
|
|
zurück, andernfalls &false;.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Falls <parameter>needle</parameter> ein String ist, wird der Vergleich
|
|
unter Beachtung der Groß-/Kleinschreibung durchgeführt.
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<para>
|
|
Vor PHP 4.2.0 gibt <function>array_search</function> im Fehlerfall
|
|
&null; statt &false; zurück.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
Ist der optionale dritte Parameter <parameter>strict</parameter>
|
|
auf &true; gesetzt, prüft <function>array_search</function>
|
|
auch die Typen von <parameter>needle</parameter> in
|
|
<parameter>haystack</parameter>.
|
|
</para>
|
|
<para>
|
|
Falls <parameter>needle</parameter> in <parameter>haystack</parameter>
|
|
mehr als einmal gefunden wird, wird der erste passende Schlüssel
|
|
zurückgegeben. Um die Schlüssel aller passenden Werte zu erhalten,
|
|
verwenden Sie stattdessen <function>array_keys</function> mit dem
|
|
optionalen Parameter <parameter>search_value</parameter>.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>array_search</function> Beispiel</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$array = array(0 => 'blau', 1 => 'rot', 2 => 'grün', 3 => 'rot');
|
|
|
|
$key = array_search('grün', $array); // $key = 2;
|
|
$key = array_search('rot', $array); // $key = 1;
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
&return.falseproblem;
|
|
<para>
|
|
Siehe auch <function>array_keys</function>,
|
|
<function>array_values</function>,
|
|
<function>array_key_exists</function>, und
|
|
<function>in_array</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
|
|
-->
|