reference/array/functions/array-column.xml
8cdc6621f9826d04abc3e50438c010804d7e8683
...
...
@@ -9,13 +9,13 @@
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
11
<type>array</type><methodname>array_column</methodname>
12
-
<methodparam><type>array</type><parameter>input</parameter></methodparam>
13
-
<methodparam><type>mixed</type><parameter>column_key</parameter></methodparam>
14
-
<methodparam choice="opt"><type>mixed</type><parameter>index_key</parameter><initializer>null</initializer></methodparam>
12
+
<methodparam><type>array</type><parameter>array</parameter></methodparam>
13
+
<methodparam><type class="union"><type>int</type><type>string</type><type>null</type></type><parameter>column_key</parameter></methodparam>
14
+
<methodparam choice="opt"><type class="union"><type>int</type><type>string</type><type>null</type></type><parameter>index_key</parameter><initializer>&null;</initializer></methodparam>
15
15
</methodsynopsis>
16
16
<para>
17
17
<function>array_column</function> returns the values from a single column of
18
-
the <parameter>input</parameter>, identified by the
18
+
the <parameter>array</parameter>, identified by the
19
19
<parameter>column_key</parameter>. Optionally, an
20
20
<parameter>index_key</parameter> may be provided to index the values in the
21
21
returned array by the values from the <parameter>index_key</parameter>
...
...
@@ -27,7 +27,7 @@
27
27
<para>
28
28
<variablelist>
29
29
<varlistentry>
30
-
<term><parameter>input</parameter></term>
30
+
<term><parameter>array</parameter></term>
31
31
<listitem>
32
32
<para>
33
33
A multi-dimensional array or an array of objects from which to pull a
...
...
@@ -57,6 +57,9 @@
57
57
<para>
58
58
The column to use as the index/keys for the returned array. This value
59
59
may be the integer key of the column, or it may be the string key name.
60
+
The value is <link linkend="language.types.array.key-casts">cast</link>
61
+
as usual for array keys (however, prior to PHP 8.0.0, objects supporting
62
+
conversion to string were also allowed).
60
63
</para>
61
64
</listitem>
62
65
</varlistentry>
...
...
@@ -82,10 +85,10 @@
82
85
</thead>
83
86
<tbody>
84
87
<row>
85
-
<entry>7.0.0</entry>
88
+
<entry>8.0.0</entry>
86
89
<entry>
87
-
Added the ability for the <parameter>input</parameter> parameter to be
88
-
an array of objects.
90
+
Objects in columns indicated by <parameter>index_key</parameter> parameter
91
+
will no longer be cast to string and will now throw a <classname>TypeError</classname> instead.
89
92
</entry>
90
93
</row>
91
94
</tbody>
...
...
@@ -272,20 +275,7 @@ Array
272
275
</para>
273
276
</refsect1>
274
277

275
-
<refsect1 role="seealso">
276
-
&reftitle.seealso;
277
-
<para>
278
-
<simplelist>
279
-
<member>
280
-
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&url.arraycolumn.compat;">Recommended
281
-
userland implementation for PHP lower than 5.5</link>
282
-
</member>
283
-
</simplelist>
284
-
</para>
285
-
</refsect1>
286
-

287
278
</refentry>
288
-

289
279
<!-- Keep this comment at the end of the file
290
280
Local variables:
291
281
mode: sgml
292
282