mirror of
https://github.com/php/doc-ja.git
synced 2026-03-26 08:02:15 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@134500 c90b9560-bf6c-de11-be94-00142212c4b1
97 lines
3.2 KiB
XML
97 lines
3.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision: 1.4 $ -->
|
|
<!-- sync: 1.2 -->
|
|
<refentry id="function.array-diff-assoc">
|
|
<refnamediv>
|
|
<refname>array_diff_assoc</refname>
|
|
<refpurpose>追加された添字の確認を含めて配列の差を計算する</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>説明</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_diff_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>
|
|
<para>
|
|
<function>array_diff_assoc</function>は、
|
|
<parameter>array1</parameter>から他の引数の配列の中に現れない全て
|
|
の値を含む<type>array</type>を返します。
|
|
<function>array_diff</function>と異なりキーが比較に使用されることに
|
|
注意して下さい。
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>array_diff_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_diff_assoc ($array1, $array2);
|
|
|
|
/* The result is:
|
|
Array
|
|
(
|
|
[b] => brown
|
|
[c] => blue
|
|
[0] => red
|
|
)
|
|
*/
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<simpara>
|
|
上の例で、<literal>"a" => "green"</literal>の組が両方の配列に現
|
|
れており、このため、この関数の出力には含まれていません。
|
|
これとは異なり、<literal>0 => "red"</literal> は出力の中にありま
|
|
すが、これは、二番目の引数において<literal>"red"</literal>が
|
|
<literal>1</literal>というキーを有しているためです。
|
|
</simpara>
|
|
<simpara>
|
|
<emphasis>key => value</emphasis>の組からの二つの値は、
|
|
<literal>(string) $elem1 === (string) $elem2 </literal>が等しい場合
|
|
のみ等しいと見なされます。
|
|
言い替えると、厳密なチェックが行われるため、文字列表現が同じである
|
|
必要があります。
|
|
<!-- TODO: example of it... -->
|
|
</simpara>
|
|
<note>
|
|
<simpara>
|
|
この関数は、N次元配列の一次元だけを調べることに注意して下さい。
|
|
もちろん、例えば、
|
|
<literal>array_diff_assoc($array1[0], $array2[0]);</literal>とする
|
|
ことにより、より深い次元でチェックを行うことも可能です。
|
|
</simpara>
|
|
</note>
|
|
<para>
|
|
<function>array_diff</function>, <function>array_intersect</function>,
|
|
<function>array_intersect_assoc</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
|
|
-->
|