PHP converts a string into an array, supports Chinese
/** * 将一个字符串转换成数组,支持中文 * @param string $string 待转换成数组的字符串 * @return string 转换后的数组 */ function strToArray($string) { $strlen = mb_strlen($string); while ($strlen) { $array[] = mb_substr($string, 0, 1, "utf8"); $string = mb_substr($string, 1, $strlen, "utf8"); $strlen = mb_strlen($string); } return $array; }
Usage:
$string = '这里就是要转换成数组的字符串,www.liqingbo.cn'; $arr = strToArray($string); print_r($arr);
Output:
Array ( [0] => 这 [1] => 里 [2] => 就 [3] => 是 [4] => 要 [5] => 转 [6] => 换 [7] => 成 [8] => 数 [9] => 组 [10] => 的 [11] => 字 [12] => 符 [13] => 串 [14] => , [15] => w [16] => w [17] => w [18] => . [19] => l [20] => i [21] => q [22] => i [23] => n [24] => g [25] => b [26] => o [27] => . [28] => c [29] => n )

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
