Skip to content

Commit f537398

Browse files
committed
[PHP 8.4] Add manual for grapheme_str_split function
1 parent be3338b commit f537398

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<refentry xml:id="function.grapheme-str-split" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4+
<refnamediv>
5+
<refname>grapheme_str_split</refname>
6+
<refpurpose>Given a grapheme cluster string, which must be encoded in UTF-8</refpurpose>
7+
</refnamediv>
8+
<refsect1 role="description">
9+
&reftitle.description;
10+
<para>&style.procedural;</para>
11+
<methodsynopsis>
12+
<type class="union"><type>array</type><type>false</type></type><methodname>grapheme_str_split</methodname>
13+
<methodparam><type>string</type><parameter>string</parameter></methodparam>
14+
<methodparam choice="opt"><type>int</type><parameter>length</parameter><initializer>1</initializer></methodparam>
15+
</methodsynopsis>
16+
<para>
17+
This function will return an array of strings, it is a version of <function>str_split</function> with support for grapheme cluster byte characters.
18+
If the <parameter>length</parameter> parameter is specified, the string is broken down into chunks of the specified length in grapheme clusters (not bytes).
19+
</para>
20+
</refsect1>
21+
22+
<refsect1 role="parameters">
23+
&reftitle.parameters;
24+
<para>
25+
<variablelist>
26+
<varlistentry>
27+
<term><parameter>string</parameter></term>
28+
<listitem>
29+
<para>
30+
The &string; to split into grapheme clusters or chunks. Must be valid UTF-8.
31+
</para>
32+
</listitem>
33+
</varlistentry>
34+
<varlistentry>
35+
<term><parameter>length</parameter></term>
36+
<listitem>
37+
<para>
38+
If specified, each element of the returned array will be composed of grapheme clusters instead of a single grapheme cluster.
39+
</para>
40+
</listitem>
41+
</varlistentry>
42+
</variablelist>
43+
</para>
44+
</refsect1>
45+
46+
<refsect1 role="seealso">
47+
&reftitle.seealso;
48+
<para>
49+
<simplelist>
50+
<member><function>str_split</function></member>
51+
<member><function>mb_str_split</function></member>
52+
<member>
53+
<link xlink:href="&uri.unicode.graphemes;">
54+
Unicode Text Segmentation: Grapheme Cluster Boundaries
55+
</link>
56+
</member>
57+
</simplelist>
58+
</para>
59+
</refsect1>
60+
</refentry>
61+
<!-- Keep this comment at the end of the file
62+
Local variables:
63+
mode: sgml
64+
sgml-omittag:t
65+
sgml-shorttag:t
66+
sgml-minimize-attributes:nil
67+
sgml-always-quote-attributes:t
68+
sgml-indent-step:1
69+
sgml-indent-data:t
70+
indent-tabs-mode:nil
71+
sgml-parent-document:nil
72+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
73+
sgml-exposed-tags:nil
74+
sgml-local-catalogs:nil
75+
sgml-local-ecat-files:nil
76+
End:
77+
vim600: syn=xml fen fdm=syntax fdl=2 si
78+
vim: et tw=78 syn=sgml
79+
vi: ts=1 sw=1
80+
-->

reference/intl/versions.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@
392392
<function name="grapheme_strstr" from="PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL intl &gt;= 1.0.0"/>
393393
<function name="grapheme_stristr" from="PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL intl &gt;= 1.0.0"/>
394394
<function name="grapheme_extract" from="PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL intl &gt;= 1.0.0"/>
395+
<function name="grapheme_str_split" from="PHP 8 &gt;= 8.4.0"/>
395396
<function name="intl_get_error_code" from="PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL intl &gt;= 1.0.0"/>
396397
<function name="intl_get_error_message" from="PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL intl &gt;= 1.0.0"/>
397398
<function name="intl_is_failure" from="PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL intl &gt;= 1.0.0"/>

reference/mbstring/functions/mb-str-split.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
<para>
9090
<simplelist>
9191
<member><function>str_split</function></member>
92+
<member><function>grapheme_str_split</function></member>
9293
</simplelist>
9394
</para>
9495
</refsect1>

reference/strings/functions/str-split.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ Array
151151
<para>
152152
<function>str_split</function> will split into bytes, rather than characters when dealing with a multi-byte encoded string.
153153
Use <function>mb_str_split</function> to split the string into code points.
154+
Use <function>grapheme_str_split</function> to split the string into grapheme clusetrs.
154155
</para>
155156
</note>
156157
</refsect1>
@@ -160,6 +161,7 @@ Array
160161
<para>
161162
<simplelist>
162163
<member><function>mb_str_split</function></member>
164+
<member><function>grapheme_str_split</function></member>
163165
<member><function>chunk_split</function></member>
164166
<member><function>preg_split</function></member>
165167
<member><function>explode</function></member>

0 commit comments

Comments
 (0)