1
0
mirror of https://github.com/php/doc-zh.git synced 2026-03-24 07:02:15 +01:00
Files
archived-doc-zh/reference/array/functions/array-intersect.xml
魔王卷子 6cdcdc341c update array part 2 (#298)
* update array part 2

* Update reference/array/functions/array-fill.xml

Co-authored-by: kang <1115610574@qq.com>

* Update reference/array/functions/array-fill.xml

Co-authored-by: 沈唁 <52o@qq52o.cn>

* Update reference/array/functions/array-fill.xml

Co-authored-by: 沈唁 <52o@qq52o.cn>

Co-authored-by: kang <1115610574@qq.com>
Co-authored-by: 沈唁 <52o@qq52o.cn>
2022-08-31 21:57:08 +08:00

146 lines
3.5 KiB
XML
Executable File

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: c84024092aee02b51dd18b909af0f2ccbdd24f98 Maintainer: daijie Status: ready -->
<refentry xml:id="function.array-intersect" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>array_intersect</refname>
<refpurpose>计算数组的交集</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>array_intersect</methodname>
<methodparam><type>array</type><parameter>array</parameter></methodparam>
<methodparam rep="repeat"><type>array</type><parameter>arrays</parameter></methodparam>
</methodsynopsis>
<para>
<function>array_intersect</function> 返回一个数组,该数组包含了所有在
<parameter>array</parameter> 和其它参数数组中同时存在的值。注意,键名保留不变。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>array</parameter></term>
<listitem>
<para>
要检查的数组,作为主值。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>arrays</parameter></term>
<listitem>
<para>
要被对比的数组。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
返回一个数组,该数组包含了所有在
<parameter>array</parameter> 和其它参数数组中同时存在的值。
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&array.changelog.require-only-one;
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>array_intersect</function> 例子</title>
<programlisting role="php">
<![CDATA[
<?php
$array1 = array("a" => "green", "red", "blue");
$array2 = array("b" => "green", "yellow", "red");
$result = array_intersect($array1, $array2);
print_r($result);
?>
]]>
</programlisting>
&example.outputs;
<screen role="php">
<![CDATA[
Array
(
[a] => green
[0] => red
)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<simpara>
两个单元仅在 <literal>(string) $elem1 === (string) $elem2</literal>
时被认为是相同的。也就是说:当字符串的表达形式相同时。
<!-- TODO: example of it... -->
</simpara>
</note>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>array_intersect_assoc</function></member>
<member><function>array_diff</function></member>
<member><function>array_diff_assoc</function></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
-->