reference/array/functions/array-diff-key.xml
c84024092aee02b51dd18b909af0f2ccbdd24f98
...
...
@@ -10,13 +10,12 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>array</type><methodname>array_diff_key</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 the keys from <parameter>array1</parameter> against the keys
19
-
from <parameter>array2</parameter> and returns the difference.
17
+
Compares the keys from <parameter>array</parameter> against the keys
18
+
from <parameter>arrays</parameter> and returns the difference.
20
19
This function is like <function>array_diff</function> except the
21
20
comparison is done on the keys instead of the values.
22
21
</para>
...
...
@@ -28,7 +27,7 @@
28
27
<variablelist>
29
28

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

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

48
-
<varlistentry>
49
-
<term><parameter>...</parameter></term>
50
-
<listitem>
51
-
<para>
52
-
More arrays to compare against
42
+
Arrays to compare against
53
43
</para>
54
44
</listitem>
55
45
</varlistentry>
...
...
@@ -62,11 +52,30 @@
62
52
&reftitle.returnvalues;
63
53
<para>
64
54
Returns an <type>array</type> containing all the entries from
65
-
<parameter>array1</parameter> whose keys are not present in any of the
55
+
<parameter>array</parameter> whose keys are absent from all of the
66
56
other arrays.
67
57
</para>
68
58
</refsect1>
69
59

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

70
79
<!--
71
80
<refsect1 role="errors">
72
81
&reftitle.errors;
...
...
@@ -86,11 +95,11 @@
86
95
a strict type check is executed so the string representation must be
87
96
the same.
88
97
</para>
89
-
<programlisting role="php">
98
+
<programlisting role="php">
90
99
<![CDATA[
91
100
<?php
92
-
$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
93
-
$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
101
+
$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
102
+
$array2 = array('green' => 5, 'yellow' => 7, 'cyan' => 8);
94
103

95
104
var_dump(array_diff_key($array1, $array2));
96
105
?>
...
...
@@ -99,6 +108,30 @@ var_dump(array_diff_key($array1, $array2));
99
108
&example.outputs;
100
109
<screen>
101
110
<![CDATA[
111
+
array(3) {
112
+
["blue"]=>
113
+
int(1)
114
+
["red"]=>
115
+
int(2)
116
+
["purple"]=>
117
+
int(4)
118
+
}
119
+
]]>
120
+
</screen>
121
+
<programlisting role="php">
122
+
<![CDATA[
123
+
<?php
124
+
$array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4);
125
+
$array2 = array('green' => 5, 'yellow' => 7, 'cyan' => 8);
126
+
$array3 = array('blue' => 6, 'yellow' => 7, 'mauve' => 8);
127
+

128
+
var_dump(array_diff_key($array1, $array2, $array3));
129
+
?>
130
+
]]>
131
+
</programlisting>
132
+
&example.outputs;
133
+
<screen>
134
+
<![CDATA[
102
135
array(2) {
103
136
["red"]=>
104
137
int(2)
105
138