reference/math/functions/base-convert.xml
19e8122137a1d42ed60f17fe2c0c2b69b0b2d16b
...
...
@@ -8,25 +8,27 @@
8
8
<refsect1 role="description">
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
-
<type>string</type><methodname>base_convert</methodname>
12
-
<methodparam><type>string</type><parameter>number</parameter></methodparam>
13
-
<methodparam><type>int</type><parameter>frombase</parameter></methodparam>
14
-
<methodparam><type>int</type><parameter>tobase</parameter></methodparam>
15
-
</methodsynopsis>
11
+
<type>string</type><methodname>base_convert</methodname>
12
+
<methodparam><type>string</type><parameter>num</parameter></methodparam>
13
+
<methodparam><type>int</type><parameter>from_base</parameter></methodparam>
14
+
<methodparam><type>int</type><parameter>to_base</parameter></methodparam>
15
+
</methodsynopsis>
16
16
<para>
17
-
Returns a string containing <parameter>number</parameter>
18
-
represented in base <parameter>tobase</parameter>. The base in
19
-
which <parameter>number</parameter> is given is specified in
20
-
<parameter>frombase</parameter>. Both
21
-
<parameter>frombase</parameter> and <parameter>tobase</parameter>
17
+
Returns a string containing <parameter>num</parameter>
18
+
represented in base <parameter>to_base</parameter>. The base in
19
+
which <parameter>num</parameter> is given is specified in
20
+
<parameter>from_base</parameter>. Both
21
+
<parameter>from_base</parameter> and <parameter>to_base</parameter>
22
22
have to be between 2 and 36, inclusive. Digits in numbers with a
23
23
base higher than 10 will be represented with the letters a-z,
24
24
with a meaning 10, b meaning 11 and z meaning 35.
25
+
The case of the letters doesn't matter, i.e.
26
+
<parameter>num</parameter> is interpreted case-insensitively.
25
27
</para>
26
28
<warning>
27
29
<simpara>
28
30
<function>base_convert</function> may lose precision on large numbers
29
-
due to properties related to the internal "double" or "float" type used.
31
+
due to properties related to the internal <type>float</type> type used.
30
32
Please see the <link linkend="language.types.float">Floating point numbers</link>
31
33
section in the manual for more specific information and limitations.
32
34
</simpara>
...
...
@@ -37,26 +39,28 @@
37
39
<para>
38
40
<variablelist>
39
41
<varlistentry>
40
-
<term><parameter>number</parameter></term>
42
+
<term><parameter>num</parameter></term>
41
43
<listitem>
42
44
<para>
43
-
The number to convert
45
+
The number to convert. Any invalid characters in
46
+
<parameter>num</parameter> are silently ignored.
47
+
As of PHP 7.4.0 supplying any invalid characters is deprecated.
44
48
</para>
45
49
</listitem>
46
50
</varlistentry>
47
51
<varlistentry>
48
-
<term><parameter>frombase</parameter></term>
52
+
<term><parameter>from_base</parameter></term>
49
53
<listitem>
50
54
<para>
51
-
The base <parameter>number</parameter> is in
55
+
The base <parameter>num</parameter> is in
52
56
</para>
53
57
</listitem>
54
58
</varlistentry>
55
59
<varlistentry>
56
-
<term><parameter>tobase</parameter></term>
60
+
<term><parameter>to_base</parameter></term>
57
61
<listitem>
58
62
<para>
59
-
The base to convert <parameter>number</parameter> to
63
+
The base to convert <parameter>num</parameter> to
60
64
</para>
61
65
</listitem>
62
66
</varlistentry>
...
...
@@ -66,9 +70,33 @@
66
70
<refsect1 role="returnvalues">
67
71
&reftitle.returnvalues;
68
72
<para>
69
-
<parameter>number</parameter> converted to base <parameter>tobase</parameter>
73
+
<parameter>num</parameter> converted to base <parameter>to_base</parameter>
70
74
</para>
71
75
</refsect1>
76
+

77
+
<refsect1 role="changelog">
78
+
&reftitle.changelog;
79
+
<informaltable>
80
+
<tgroup cols="2">
81
+
<thead>
82
+
<row>
83
+
<entry>&Version;</entry>
84
+
<entry>&Description;</entry>
85
+
</row>
86
+
</thead>
87
+
<tbody>
88
+
<row>
89
+
<entry>7.4.0</entry>
90
+
<entry>
91
+
Passing invalid characters will now generate a deprecation notice.
92
+
The result will still be computed as if the invalid characters did not exist.
93
+
</entry>
94
+
</row>
95
+
</tbody>
96
+
</tgroup>
97
+
</informaltable>
98
+
</refsect1>
99
+

72
100
<refsect1 role="examples">
73
101
&reftitle.examples;
74
102
<para>
...
...
@@ -77,7 +105,7 @@
77
105
<programlisting role="php">
78
106
<![CDATA[
79
107
<?php
80
-
$hexadecimal = 'A37334';
108
+
$hexadecimal = 'a37334';
81
109
echo base_convert($hexadecimal, 16, 2);
82
110
?>
83
111
]]>
...
...
@@ -100,7 +128,6 @@ echo base_convert($hexadecimal, 16, 2);
100
128
</para>
101
129
</refsect1>
102
130
</refentry>
103
-

104
131
<!-- Keep this comment at the end of the file
105
132
Local variables:
106
133
mode: sgml
107
134