reference/array/functions/array-diff-assoc.xml
6b64170daac5587bee4bb63c0020cb2fbf7f1253
...
...
@@ -87,11 +87,13 @@
87
87
<example>
88
88
<title><function>array_diff_assoc</function> example</title>
89
89
<para>
90
-
In this example you see the <literal>"a" =&gt; "green"</literal>
90
+
In this example the <literal>"a" =&gt; "green"</literal>
91
91
pair is present in both arrays and thus it is not in the output from the
92
92
function. Unlike this, the pair <literal>0 =&gt; "red"</literal>
93
-
is in the output because in the second argument <literal>"red"</literal>
94
-
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>.
95
97
</para>
96
98
<programlisting role="php">
97
99
<![CDATA[
...
...
@@ -142,7 +144,7 @@ Array
142
144
(
143
145
[0] => 0
144
146
[1] => 1
145
-
)
147
+
)
146
148
]]>
147
149
</screen>
148
150
</example>
...
...
@@ -153,14 +155,14 @@ Array
153
155
&reftitle.notes;
154
156
<note>
155
157
<simpara>
156
-
This function only checks one dimension of a n-dimensional
157
-
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,
158
160
<literal>array_diff_assoc($array1[0], $array2[0]);</literal>.
159
161
</simpara>
160
162
</note>
161
163
<note>
162
164
<simpara>
163
-
Ensure you pass arguments in the correct order when comparing similar
165
+
Ensure arguments are passed in the correct order when comparing similar
164
166
arrays with more keys. The new array should be the first in the list.
165
167
</simpara>
166
168
</note>
167
169