php Method to convert Chinese string to array: First create a PHP sample file; then define a Chinese string; then use functions such as "mb_substr" to convert the Chinese string into an array.
Recommended: "PHP Video Tutorial"
php Convert Chinese character string to array
Code:
$topictitle="沙漠骆驼"; $length = mb_strlen($topictitle, 'utf-8'); $titlearray = []; for ($i=0; $i<$length; $i++) { $titlearray[] = mb_substr($topictitle, $i, 1, 'utf-8'); } return $titlearray;
Effect:
The above is the detailed content of How to convert Chinese string to array in php. For more information, please follow other related articles on the PHP Chinese website!