reference/array/functions/array-sum.xml
443d81b33e6537a000cc235c2a11748ba8d56232
...
...
@@ -8,7 +8,7 @@
8
8
<refsect1 role="description">
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
-
<type>number</type><methodname>array_sum</methodname>
11
+
<type class="union"><type>int</type><type>float</type></type><methodname>array_sum</methodname>
12
12
<methodparam><type>array</type><parameter>array</parameter></methodparam>
13
13
</methodsynopsis>
14
14
<para>
...
...
@@ -33,9 +33,11 @@
33
33
<refsect1 role="returnvalues">
34
34
&reftitle.returnvalues;
35
35
<para>
36
-
Returns the sum of values as an integer or float.
36
+
Returns the sum of values as an integer or float; <literal>0</literal> if the
37
+
<parameter>array</parameter> is empty.
37
38
</para>
38
39
</refsect1>
40
+

39
41
<refsect1 role="changelog">
40
42
&reftitle.changelog;
41
43
<para>
...
...
@@ -49,11 +51,12 @@
49
51
</thead>
50
52
<tbody>
51
53
<row>
52
-
<entry>4.2.1</entry>
54
+
<entry>8.3.0</entry>
53
55
<entry>
54
-
PHP versions prior to 4.2.1 modified the passed array itself and
55
-
converted strings to numbers (which most of the time converted them
56
-
to zero, depending on their value).
56
+
Now emits <constant>E_WARNING</constant> when <parameter>array</parameter> values
57
+
cannot be converted to &integer; or &float;.
58
+
Previously &array;s and &object;s where ignored whilst every other value was cast to &integer;.
59
+
Moreover, objects that define a numeric cast (e.g. <classname>GMP</classname>) are now cast instead of ignored.
57
60
</entry>
58
61
</row>
59
62
</tbody>
...
...
@@ -61,6 +64,7 @@
61
64
</informaltable>
62
65
</para>
63
66
</refsect1>
67
+

64
68
<refsect1 role="examples">
65
69
&reftitle.examples;
66
70
<para>
67
71