reference/mbstring/functions/mb-strimwidth.xml
ca4b9d11a25fc9f8dde7561c504ed466ed1d6c63
...
...
@@ -10,14 +10,18 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>string</type><methodname>mb_strimwidth</methodname>
13
-
<methodparam><type>string</type><parameter>str</parameter></methodparam>
13
+
<methodparam><type>string</type><parameter>string</parameter></methodparam>
14
14
<methodparam><type>int</type><parameter>start</parameter></methodparam>
15
15
<methodparam><type>int</type><parameter>width</parameter></methodparam>
16
-
<methodparam choice="opt"><type>string</type><parameter>trimmarker</parameter><initializer>&quot;&quot;</initializer></methodparam>
17
-
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter><initializer>mb_internal_encoding()</initializer></methodparam>
16
+
<methodparam choice="opt"><type>string</type><parameter>trim_marker</parameter><initializer>""</initializer></methodparam>
17
+
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
18
18
</methodsynopsis>
19
19
<para>
20
-
Truncates <type>string</type> <parameter>str</parameter> to specified <parameter>width</parameter>.
20
+
Truncates <type>string</type> <parameter>string</parameter> to specified <parameter>width</parameter>,
21
+
where halfwidth characters count as <literal>1</literal>, and fullwidth
22
+
characters count as <literal>2</literal>.
23
+
See <link xlink:href="&url.unicode.reports.tr;11/">&url.unicode.reports.tr;11/</link>
24
+
for details regarding East Asian character widths.
21
25
</para>
22
26
</refsect1>
23
27

...
...
@@ -26,7 +30,7 @@
26
30
<para>
27
31
<variablelist>
28
32
<varlistentry>
29
-
<term><parameter>str</parameter></term>
33
+
<term><parameter>string</parameter></term>
30
34
<listitem>
31
35
<para>
32
36
The <type>string</type> being decoded.
...
...
@@ -47,12 +51,18 @@
47
51
<term><parameter>width</parameter></term>
48
52
<listitem>
49
53
<para>
50
-
The width of the desired trim. Negative widths count from the end of the string.
54
+
The width of the desired trim.
55
+
If negative width is specified, count from the end of the string.
56
+
<note>
57
+
<para>
58
+
Passing negative width is deprecated as of PHP 8.3.0.
59
+
</para>
60
+
</note>
51
61
</para>
52
62
</listitem>
53
63
</varlistentry>
54
64
<varlistentry>
55
-
<term><parameter>trimmarker</parameter></term>
65
+
<term><parameter>trim_marker</parameter></term>
56
66
<listitem>
57
67
<para>
58
68
A string that is added to the end of string
...
...
@@ -73,8 +83,8 @@
73
83
<refsect1 role="returnvalues">
74
84
&reftitle.returnvalues;
75
85
<para>
76
-
The truncated <type>string</type>. If <parameter>trimmarker</parameter> is set,
77
-
<parameter>trimmarker</parameter> replaces the last chars to match the <parameter>width</parameter>.
86
+
The truncated <type>string</type>. If <parameter>trim_marker</parameter> is set,
87
+
<parameter>trim_marker</parameter> replaces the last chars to match the <parameter>width</parameter>.
78
88
</para>
79
89
</refsect1>
80
90

...
...
@@ -90,6 +100,14 @@
90
100
</thead>
91
101
<tbody>
92
102
<row>
103
+
<entry>8.3.0</entry>
104
+
<entry>
105
+
Passing a negative <parameter>width</parameter> to
106
+
<function>mb_strimwidth</function> is now deprecated.
107
+
</entry>
108
+
</row>
109
+
&mbstring.changelog.encoding-nullable;
110
+
<row>
93
111
<entry>7.1.0</entry>
94
112
<entry>
95
113
Support for negative <parameter>start</parameter>s and <parameter>width</parameter>s has been added.
...
...
@@ -128,7 +146,6 @@ echo mb_strimwidth("Hello World", 0, 10, "...");
128
146
</refsect1>
129
147

130
148
</refentry>
131
-

132
149
<!-- Keep this comment at the end of the file
133
150
Local variables:
134
151
mode: sgml
135
152