mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Clarify what the 'width' in mb_strimwidth means
Co-authored-by: Alex Dowad <alexinbeijing@gmail.com> Closes GH-124.
This commit is contained in:
parent
8b7fb1d4ac
commit
a69f6cf5d2
2 changed files with 31 additions and 1 deletions
|
@ -17,7 +17,11 @@
|
|||
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Truncates <type>string</type> <parameter>string</parameter> to specified <parameter>width</parameter>.
|
||||
Truncates <type>string</type> <parameter>string</parameter> to specified <parameter>width</parameter>,
|
||||
where halfwidth characters count as <literal>1</literal>, and fullwidth
|
||||
characters count as <literal>2</literal>.
|
||||
See <link xlink:href="&url.unicode.reports.tr;11/">&url.unicode.reports.tr;11/</link>
|
||||
for details regarding East Asian character widths.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
Returns the width of <type>string</type> <parameter>string</parameter>,
|
||||
where halfwidth characters count as <literal>1</literal>, and fullwidth
|
||||
characters count as <literal>2</literal>.
|
||||
See <link xlink:href="&url.unicode.reports.tr;11/">&url.unicode.reports.tr;11/</link>
|
||||
for details regarding East Asian character widths.
|
||||
</para>
|
||||
<para>
|
||||
The fullwidth characters are:
|
||||
|
@ -109,6 +111,30 @@
|
|||
</informaltable>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example xml:id="mb-strwidth.example.basic">
|
||||
<title><function>mb_strwidth</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
var_dump(
|
||||
mb_strwidth('a'), // LATIN SMALL LETTER A
|
||||
mb_strwidth("\u{ff41}") // FULLWIDTH LATIN SMALL LETTER A
|
||||
);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
int(1)
|
||||
int(2)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
|
|
Loading…
Reference in a new issue