reference/array/functions/array-diff-assoc.xml
6b64170daac5587bee4bb63c0020cb2fbf7f1253
...
...
@@ -10,12 +10,11 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>array</type><methodname>array_diff_assoc</methodname>
13
-
<methodparam><type>array</type><parameter>array1</parameter></methodparam>
14
-
<methodparam><type>array</type><parameter>array2</parameter></methodparam>
15
-
<methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam>
13
+
<methodparam><type>array</type><parameter>array</parameter></methodparam>
14
+
<methodparam rep="repeat"><type>array</type><parameter>arrays</parameter></methodparam>
16
15
</methodsynopsis>
17
16
<para>
18
-
Compares <parameter>array1</parameter> against <parameter>array2</parameter> and
17
+
Compares <parameter>array</parameter> against <parameter>arrays</parameter> and
19
18
returns the difference. Unlike <function>array_diff</function> the array
20
19
keys are also used in the comparison.
21
20
</para>
...
...
@@ -27,7 +26,7 @@
27
26
<variablelist>
28
27

29
28
<varlistentry>
30
-
<term><parameter>array1</parameter></term>
29
+
<term><parameter>array</parameter></term>
31
30
<listitem>
32
31
<para>
33
32
The array to compare from
...
...
@@ -36,19 +35,10 @@
36
35
</varlistentry>
37
36

38
37
<varlistentry>
39
-
<term><parameter>array2</parameter></term>
38
+
<term><parameter>arrays</parameter></term>
40
39
<listitem>
41
40
<para>
42
-
An array to compare against
43
-
</para>
44
-
</listitem>
45
-
</varlistentry>
46
-

47
-
<varlistentry>
48
-
<term><parameter>...</parameter></term>
49
-
<listitem>
50
-
<para>
51
-
More arrays to compare against
41
+
Arrays to compare against
52
42
</para>
53
43
</listitem>
54
44
</varlistentry>
...
...
@@ -61,7 +51,26 @@
61
51
&reftitle.returnvalues;
62
52
<para>
63
53
Returns an <type>array</type> containing all the values from
64
-
<parameter>array1</parameter> that are not present in any of the other arrays.
54
+
<parameter>array</parameter> that are not present in any of the other arrays.
55
+
</para>
56
+
</refsect1>
57
+

58
+
<refsect1 role="changelog">
59
+
&reftitle.changelog;
60
+
<para>
61
+
<informaltable>
62
+
<tgroup cols="2">
63
+
<thead>
64
+
<row>
65
+
<entry>&Version;</entry>
66
+
<entry>&Description;</entry>
67
+
</row>
68
+
</thead>
69
+
<tbody>
70
+
&array.changelog.require-only-one;
71
+
</tbody>
72
+
</tgroup>
73
+
</informaltable>
65
74
</para>
66
75
</refsect1>
67
76

...
...
@@ -78,11 +87,13 @@
78
87
<example>
79
88
<title><function>array_diff_assoc</function> example</title>
80
89
<para>
81
-
In this example you see the <literal>"a" =&gt; "green"</literal>
90
+
In this example the <literal>"a" =&gt; "green"</literal>
82
91
pair is present in both arrays and thus it is not in the output from the
83
92
function. Unlike this, the pair <literal>0 =&gt; "red"</literal>
84
-
is in the output because in the second argument <literal>"red"</literal>
85
-
has key which is <literal>1</literal>.
93
+
is in the output because the key of <literal>"red"</literal> is
94
+
automatically assigned to <literal>0</literal> in the first array,
95
+
whereas it is assigned to <literal>1</literal> in the second array as the
96
+
key <literal>0</literal> is already taken by <literal>yellow</literal>.
86
97
</para>
87
98
<programlisting role="php">
88
99
<![CDATA[
...
...
@@ -133,7 +144,7 @@ Array
133
144
(
134
145
[0] => 0
135
146
[1] => 1
136
-
)
147
+
)
137
148
]]>
138
149
</screen>
139
150
</example>
...
...
@@ -144,14 +155,14 @@ Array
144
155
&reftitle.notes;
145
156
<note>
146
157
<simpara>
147
-
This function only checks one dimension of a n-dimensional
148
-
array. Of course you can check deeper dimensions by using, for example,
158
+
This function only checks one dimension of an n-dimensional
159
+
array. It is possible to check deeper dimensions by using, for example,
149
160
<literal>array_diff_assoc($array1[0], $array2[0]);</literal>.
150
161
</simpara>
151
162
</note>
152
163
<note>
153
164
<simpara>
154
-
Ensure you pass arguments in the correct order when comparing similar
165
+
Ensure arguments are passed in the correct order when comparing similar
155
166
arrays with more keys. The new array should be the first in the list.
156
167
</simpara>
157
168
</note>
158
169