diff --git a/reference/intl/grapheme/grapheme-str-split.xml b/reference/intl/grapheme/grapheme-str-split.xml new file mode 100644 index 000000000000..9c15f9e5f62e --- /dev/null +++ b/reference/intl/grapheme/grapheme-str-split.xml @@ -0,0 +1,99 @@ + + + + + grapheme_str_split + Split a string into an array + + + &reftitle.description; + + arrayfalsegrapheme_str_split + stringstring + intlength1 + + + This function will return an array of strings, + it is a version of str_split + with support for grapheme cluster byte characters. + If the length parameter is specified, + the string is broken down into chunks of the specified length + in grapheme clusters (not bytes). + + + + + &reftitle.parameters; + + + + string + + + The string to split into grapheme clusters or chunks. + string must be valid UTF-8. + + + + + length + + + Each element of the returned array will be composed of length grapheme clusters. + + + + + + + + + &reftitle.returnvalues; + + grapheme_str_split returns an array of strings, &return.falseforfailure;. + + + + + &reftitle.errors; + + If length is less than 1, + a ValueError will be thrown. + + + + + &reftitle.seealso; + + + str_split + mb_str_split + + + Unicode Text Segmentation: Grapheme Cluster Boundaries + + + + + + + diff --git a/reference/intl/versions.xml b/reference/intl/versions.xml index 6b4b422cbe6f..ce66042ad19a 100644 --- a/reference/intl/versions.xml +++ b/reference/intl/versions.xml @@ -392,6 +392,7 @@ + diff --git a/reference/mbstring/functions/mb-str-split.xml b/reference/mbstring/functions/mb-str-split.xml index 0ab739e18b8d..ac60cd73c7b3 100644 --- a/reference/mbstring/functions/mb-str-split.xml +++ b/reference/mbstring/functions/mb-str-split.xml @@ -89,6 +89,7 @@ str_split + grapheme_str_split diff --git a/reference/strings/functions/str-split.xml b/reference/strings/functions/str-split.xml index 8430f128f397..18483d026378 100644 --- a/reference/strings/functions/str-split.xml +++ b/reference/strings/functions/str-split.xml @@ -150,7 +150,8 @@ Array str_split will split into bytes, rather than characters when dealing with a multi-byte encoded string. - Use mb_str_split to split the string into code points. + mb_str_split can be used to split the string into code points. + grapheme_str_split can be used to split the string into grapheme clusters. @@ -160,6 +161,7 @@ Array mb_str_split + grapheme_str_split chunk_split preg_split explode