mb_str_split() Split multibyte string View as Markdown

Implemented (PHP 7.4)
Authors
rumi, legale.legale@gmail.com
Date
2019-01-02
Source
wiki.php.net/rfc/mb_str_split

Vote

Include mb_str_split into next PHP-7.x? closed
Yes
10
No
1
11 voters
ashnazg Yes 2019-01-16 16:18
colinodell Yes 2019-01-12 14:26
galvao Yes 2019-01-18 17:24
girgias Yes 2019-01-10 18:57
kalle Yes 2019-01-18 12:17
kguest Yes 2019-01-10 17:52
lex Yes 2019-01-18 09:35
mcmic Yes 2019-01-14 12:53
petk Yes 2019-01-16 15:58
salathe No 2019-01-14 19:47
yunosh Yes 2019-01-11 09:01

Discussions on the mailing list

RFC mb_str_split
by Legale Legage · 1 message
[RFC][VOTE] mb_str_split
by Legale Legage · 7 messages
[RFC][VOTE] mb_str_split
by Legale Legage · 1 message
reasonability of change the mbfl library
by Legale Legage · 6 messages

RFC text

Copied from wiki.php.net, last synchronized Oct 13, 2026 11:51 UTC

Introduction

mb_str_split is a function to perform string splitting to an array of defined size chunks.

Description

array mb_str_split (string $string [, integer $split_length = 1, string $encoding = mb_internal_encoding() ])

The function works through the libmbfl library and supports all libmbfl supported charsets just like other mbstring functions.

Usage example

<?php 
print_r(mb_str_split("победа", 2));
 
--EXPECT--
 
Array
(
    [0] => по
    [1] => бе
    [2] => да
)

Proposal

Include function into the existent mbstring extension.

Proposed PHP Version(s)

next PHP-7.x

RFC Impact

To Existing Extensions

mbstring

To Opcache

Opcache is not affected.

New Constants

No.

Open Issues

No.

Future Scope

No.

Proposed Voting Choices

This project requires 50%+1 majority. The voting period: from 2019-01-10 to 2019-01-20.

Vote: Include mb_str_split into next PHP-7.x? — Yes: 10 · No: 1 (closed)

Patches and Tests

https://github.com/php/php-src/pull/3715https://github.com/php/php-src/pull/3808

Implementation

  1. Was merged into master (PHP-7.4)
  2. https://github.com/php/php-src/commit/d77ad27415a34e4f5908cb262567b7b6f0eca17f