1
0
mirror of https://github.com/php/doc-zh.git synced 2026-03-26 08:02:16 +01:00
Files
archived-doc-zh/reference/array/functions/array-search.xml
Dallas Wang 877f5fa4fc Translation completed.
git-svn-id: https://svn.php.net/repository/phpdoc/zh/trunk@95317 c90b9560-bf6c-de11-be94-00142212c4b1
2002-09-09 21:00:24 +00:00

62 lines
1.9 KiB
XML
Executable File

<?xml version="1.0" encoding="gb2312"?>
<!-- $Revision: 1.1 $ -->
<!-- $Author: dallas $ -->
<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready -->
<refentry id="function.array-search">
<refnamediv>
<refname>array_search</refname>
<refpurpose>
在数组中搜索给定的值,如果成功则返回相应的键名
</refpurpose>
</refnamediv>
<refsect1>
<title>说明</title>
<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>
<parameter>haystack</parameter> 中搜索
<parameter>needle</parameter> 参数并在找到的情况下返回键名,否则返回 &false;
</para>
<note>
<para>
在 PHP 4.2.0 之前,<function>array_search</function> 在失败时返回
<constant>NULL</constant> 而不是 &false;
</para>
</note>
<para>
如果可选的第三个参数 <parameter>strict</parameter>&true;,则
<function>array_search</function> 还将在 <parameter>haystack</parameter>
中检查 <parameter>needle</parameter> 的类型。
</para>
&return.falseproblem;
<para>
参见 <function>array_keys</function><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
-->