mirror of
https://github.com/php/doc-ja.git
synced 2026-03-26 08:02:15 +01:00
change linefeed CR+LF -> LF git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@134499 c90b9560-bf6c-de11-be94-00142212c4b1
90 lines
2.9 KiB
XML
90 lines
2.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision: 1.2 $ -->
|
|
<!-- sync: 1.2 -->
|
|
<refentry id="function.array-intersect-assoc">
|
|
<refnamediv>
|
|
<refname>array_intersect_assoc</refname>
|
|
<refpurpose>追加された添字の確認も含めて配列の共通項を確認する</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>説明</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_intersect_assoc</methodname>
|
|
<methodparam><type>array</type><parameter>array1</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>array2</parameter></methodparam>
|
|
<methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
<function>array_intersect_assoc</function>は、全ての引数に現れる
|
|
<parameter>array1</parameter>の全ての値を含む配列を返します。
|
|
<function>array_intersect</function>と異なりキーが比較に使用される
|
|
ことに注意して下さい。
|
|
</simpara>
|
|
<para>
|
|
<example>
|
|
<title><function>array_intersect_assoc</function>の例</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$array1 = array ("a" => "green", "b" => "brown", "c" => "blue", "red");
|
|
$array2 = array ("a" => "green", "yellow", "red");
|
|
$result_array = array_intersect_assoc ($array1, $array2);
|
|
|
|
/* $result_array will look like:
|
|
|
|
Array
|
|
(
|
|
[a] => green
|
|
)
|
|
|
|
*/
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<simpara>
|
|
上の例で、<literal>"a" => "green"</literal>の組のみが両方の配列
|
|
に現れており、よって配列として返されていることがわかります。
|
|
値<literal>"red"</literal>は返されません。これは、
|
|
<varname>$array1</varname>においてはそのキーが
|
|
<literal>2</literal>であり、一方、<varname>$array2</varname>におい
|
|
てはキーが<literal>1</literal>であるためです。
|
|
</simpara>
|
|
<simpara>
|
|
<emphasis>key => value</emphasis>の組からの二つの値は、
|
|
<literal>(string) $elem1 === (string) $elem2 </literal>が等しい場合
|
|
のみ等しいと見なされます。
|
|
言い替えると、厳密なチェックが行われるため、文字列表現が同じである
|
|
必要があります。
|
|
<!-- TODO: example of it... -->
|
|
</simpara>
|
|
<simpara>
|
|
<function>array_intersect</function>,
|
|
<function>array_diff</function>,
|
|
<function>array_diff_assoc</function>も参照してください。
|
|
</simpara>
|
|
</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
|
|
-->
|