Voting

: three plus two?
(Example: nine)

The Note You're Voting On

boukeversteegh at gmail dot com
14 years ago
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] => 票
)

<< Back to user notes page

To Top