First, we introduce the function of Str_split ().
Its role is to split the string into arrays;
For example:
$str = ' ABCDE ';
Str_plite ($STR);
The results printed are as follows:
Array
(
[0] => a
[1] => b
[2] => C
[3] => D
[4] => E
)
It seems to be very easy to use, but as a Chinese programmer, it is inevitable to deal with Chinese;
At this time again with Str_splite will be tragic found garbled;;
Don't be afraid; Preg_splite can save the problem;
Of course, it needs to be used in conjunction with regular use;
/**
* Splits a string into
arrays * @param string $STR strings
* @return Array split-
function Mb_str_spl It ($STR) {return
preg_split (? <!^) (?! $/U ', $str);
$str = ' Bai Jun remote blog ';
Mb_str_split ($STR);
The results are as follows:
Array
(
[0] => white
[1] => June
[2] => remote
[3] => bo
[4] => guest
)
To finish a call;