reference/array/functions/array-push.xml
627fb8f8675566dfd9c3977e3ad2d9fc7b3b3876
...
...
@@ -10,8 +10,7 @@
10
10
<methodsynopsis>
11
11
<type>int</type><methodname>array_push</methodname>
12
12
<methodparam><type>array</type><parameter role="reference">array</parameter></methodparam>
13
-
<methodparam><type>mixed</type><parameter>value1</parameter></methodparam>
14
-
<methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam>
13
+
<methodparam rep="repeat"><type>mixed</type><parameter>values</parameter></methodparam>
15
14
</methodsynopsis>
16
15
<para>
17
16
<function>array_push</function> treats <parameter>array</parameter> as a
...
...
@@ -30,15 +29,15 @@ $array[] = $var;
30
29
<note>
31
30
<simpara>
32
31
If you use <function>array_push</function> to add one element to the
33
-
array it's better to use <literal>$array[] = </literal> because in that
32
+
array, it's better to use <literal>$array[] = </literal> because in that
34
33
way there is no overhead of calling a function.
35
34
</simpara>
36
35
</note>
37
36
<note>
38
37
<simpara>
39
38
<function>array_push</function> will raise a warning if the first
40
-
argument is not an array. This differs from the
41
-
<literal>$var[]</literal> behaviour where a new array is created.
39
+
argument is not an array. This differed from the
40
+
<literal>$var[]</literal> behaviour where a new array was created, prior to PHP 7.1.0.
42
41
</simpara>
43
42
</note>
44
43
</refsect1>
...
...
@@ -55,10 +54,10 @@ $array[] = $var;
55
54
</listitem>
56
55
</varlistentry>
57
56
<varlistentry>
58
-
<term><parameter>value1</parameter></term>
57
+
<term><parameter>values</parameter></term>
59
58
<listitem>
60
59
<para>
61
-
The first value to push onto the end of the <parameter>array</parameter>.
60
+
The values to push onto the end of the <parameter>array</parameter>.
62
61
</para>
63
62
</listitem>
64
63
</varlistentry>
...
...
@@ -71,6 +70,32 @@ $array[] = $var;
71
70
Returns the new number of elements in the array.
72
71
</para>
73
72
</refsect1>
73
+

74
+
<refsect1 role="changelog">
75
+
&reftitle.changelog;
76
+
<para>
77
+
<informaltable>
78
+
<tgroup cols="2">
79
+
<thead>
80
+
<row>
81
+
<entry>&Version;</entry>
82
+
<entry>&Description;</entry>
83
+
</row>
84
+
</thead>
85
+
<tbody>
86
+
<row>
87
+
<entry>7.3.0</entry>
88
+
<entry>
89
+
This function can now be called with only one parameter. Formerly, at
90
+
least two parameters have been required.
91
+
</entry>
92
+
</row>
93
+
</tbody>
94
+
</tgroup>
95
+
</informaltable>
96
+
</para>
97
+
</refsect1>
98
+

74
99
<refsect1 role="examples">
75
100
&reftitle.examples;
76
101
<para>
77
102