note 120458 deleted from function.str-split by crell
| From: | crell@php.net | Date: | Wed, 29 Jun 2022 17:55:57 +0000 |
| Subject: | note 120458 deleted from function.str-split by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218668@lists.php.net to get a copy of this message | ||
Note Submitter: Perl Rules
----
Unicode str_split without use of mbstring. Based on PCRE_UTF8 feature.
function mb_str_split($str, $len){
$chars = preg_split('/(?<!^)(?!$)/u', $str );
$out = array();
foreach( array_chunk($chars, $len) as $a ){
$out[] = join("", $a);
}
return $out;
}