php 分解所有字符
我正在寻找js中PHP的等效物。'this is a string'.split('')
如果我尝试,我收到一个错误$array = explode('', 'testing');
Warning: explode() [function.explode]: Empty delimiter in
有没有另一种方法可以做到这一点?
我正在寻找js中PHP的等效物。'this is a string'.split('')
如果我尝试,我收到一个错误$array = explode('', 'testing');
Warning: explode() [function.explode]: Empty delimiter in
有没有另一种方法可以做到这一点?
如错误所示,需要分隔符来拆分字符串。请改用str_split
:explode
$arr = str_split('testing');
输出
Array
(
[0] => t
[1] => e
[2] => s
[3] => t
[4] => i
[5] => n
[6] => g
)