reference/var/functions/intval.xml
18c4f78a828232c909056490ccf0a858d002e6ef
...
...
@@ -10,14 +10,14 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>int</type><methodname>intval</methodname>
13
-
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
13
+
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
14
14
<methodparam choice="opt"><type>int</type><parameter>base</parameter><initializer>10</initializer></methodparam>
15
15
</methodsynopsis>
16
16
<para>
17
-
Returns the <type>integer</type> value of <parameter>var</parameter>,
17
+
Returns the <type>int</type> value of <parameter>value</parameter>,
18
18
using the specified <parameter>base</parameter> for the conversion
19
19
(the default is base 10). <function>intval</function> should not be used
20
-
on objects, as doing so will emit an <constant>E_NOTICE</constant> level
20
+
on objects, as doing so will emit an <constant>E_WARNING</constant> level
21
21
error and return 1.
22
22
</para>
23
23
</refsect1>
...
...
@@ -27,7 +27,7 @@
27
27
<para>
28
28
<variablelist>
29
29
<varlistentry>
30
-
<term><parameter>var</parameter></term>
30
+
<term><parameter>value</parameter></term>
31
31
<listitem>
32
32
<para>
33
33
The scalar value being converted to an integer
...
...
@@ -43,7 +43,7 @@
43
43
<note>
44
44
<para>
45
45
If <parameter>base</parameter> is 0, the base used is determined
46
-
by the format of <parameter>var</parameter>:
46
+
by the format of <parameter>value</parameter>:
47
47
<itemizedlist>
48
48
<listitem>
49
49
<simpara>
...
...
@@ -53,6 +53,12 @@
53
53
</listitem>
54
54
<listitem>
55
55
<simpara>
56
+
if string starts with a "0b" (or "0B"), the base is taken
57
+
as 2 (binary); otherwise,
58
+
</simpara>
59
+
</listitem>
60
+
<listitem>
61
+
<simpara>
56
62
if string starts with "0", the base is taken as 8 (octal);
57
63
otherwise,
58
64
</simpara>
...
...
@@ -74,7 +80,7 @@
74
80
<refsect1 role="returnvalues">
75
81
&reftitle.returnvalues;
76
82
<para>
77
-
The integer value of <parameter>var</parameter> on success, or 0 on
83
+
The integer value of <parameter>value</parameter> on success, or 0 on
78
84
failure. Empty arrays return 0, non-empty arrays return 1.
79
85
</para>
80
86
<para>
...
...
@@ -92,13 +98,35 @@
92
98
</para>
93
99
</refsect1>
94
100

101
+
<refsect1 role="changelog">
102
+
&reftitle.changelog;
103
+
<informaltable>
104
+
<tgroup cols="2">
105
+
<thead>
106
+
<row>
107
+
<entry>&Version;</entry>
108
+
<entry>&Description;</entry>
109
+
</row>
110
+
</thead>
111
+
<tbody>
112
+
<row>
113
+
<entry>8.0.0</entry>
114
+
<entry>
115
+
The error level when converting from object was changed from <constant>E_NOTICE</constant> to <constant>E_WARNING</constant>.
116
+
</entry>
117
+
</row>
118
+
</tbody>
119
+
</tgroup>
120
+
</informaltable>
121
+
</refsect1>
122
+

95
123
<refsect1 role="examples">
96
124
&reftitle.examples;
97
125
<para>
98
126
<example>
99
127
<title><function>intval</function> examples</title>
100
128
<para>
101
-
The following examples are based on a 32 bit system.
129
+
The following examples are based on a 64 bit system.
102
130
</para>
103
131
<programlisting role="php">
104
132
<![CDATA[
...
...
@@ -110,12 +138,14 @@ echo intval('+42'); // 42
110
138
echo intval('-42'); // -42
111
139
echo intval(042); // 34
112
140
echo intval('042'); // 42
113
-
echo intval(1e10); // 1410065408
114
-
echo intval('1e10'); // 1
141
+
echo intval(1e10); // 10000000000
142
+
echo intval('1e10'); // 10000000000
115
143
echo intval(0x1A); // 26
144
+
echo intval('0x1A'); // 0
145
+
echo intval('0x1A', 0); // 26
116
146
echo intval(42000000); // 42000000
117
-
echo intval(420000000000000000000); // 0
118
-
echo intval('420000000000000000000'); // 2147483647
147
+
echo intval(420000000000000000000); // -4275113695319687168
148
+
echo intval('420000000000000000000'); // 9223372036854775807
119
149
echo intval(42, 8); // 42
120
150
echo intval('42', 8); // 34
121
151
echo intval(array()); // 0
...
...
@@ -134,7 +164,7 @@ echo intval(true); // 1
134
164
<note>
135
165
<para>
136
166
The <parameter>base</parameter> parameter has no effect unless the
137
-
<parameter>var</parameter> parameter is a string.
167
+
<parameter>value</parameter> parameter is a string.
138
168
</para>
139
169
</note>
140
170
</refsect1>
...
...
@@ -154,7 +184,6 @@ echo intval(true); // 1
154
184
</para>
155
185
</refsect1>
156
186
</refentry>
157
-

158
187
<!-- Keep this comment at the end of the file
159
188
Local variables:
160
189
mode: sgml
161
190