note 99851 added to function.mb-split
| From: | boukeversteegh at gmail dot com | Date: | Fri, 10 Sep 2010 16:43:15 +0000 |
| Subject: | note 99851 added to function.mb-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172450@lists.php.net to get a copy of this message | ||
In addition to Sezer Yalcin's tip.
This function splits a multibyte string into an array of characters. Comparable to str_split().
<?php
function mb_str_split( $string ) {
# Split at all position not after the start: ^
# and not before the end: $
return preg_split('/(?<!^)(?!$)/u', $string );
}
$string = 'ç«è½¦ç¥¨';
$charlist = mb_str_split( $string );
print_r( $charlist );
# Prints:
Array
(
[0] => ç«
[1] => 车
[2] => 票
)
----
Server IP: 69.147.83.197
Probable Submitter: 145.53.45.17
----
Manual Page -- http://www.php.net/manual/en/function.mb-split.php
Edit -- https://master.php.net/note/edit/99851
Del: integrated -- https://master.php.net/note/delete/99851/integrated
Del: useless -- https://master.php.net/note/delete/99851/useless
Del: bad code -- https://master.php.net/note/delete/99851/bad+code
Del: spam -- https://master.php.net/note/delete/99851/spam
Del: non-english -- https://master.php.net/note/delete/99851/non-english
Del: in docs -- https://master.php.net/note/delete/99851/in+docs
Del: other reasons-- https://master.php.net/note/delete/99851
Reject -- https://master.php.net/note/reject/99851
Search -- https://master.php.net/manage/user-notes.php