php爆炸所有字符 [英] php explode all characters
本文介绍了php爆炸所有字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找相当于 js 中的 'this is a string'.split('')
for PHP.
I'm looking for the equivalent of what in js would be 'this is a string'.split('')
for PHP.
如果我尝试 $array =explode('', 'testing');
我得到一个错误 警告:explode() [function.explode]: Empty delimiter in
If I try $array = explode('', 'testing');
I get an error Warning: explode() [function.explode]: Empty delimiter in
还有其他方法可以做到这一点吗?
Is there another way to do this?
推荐答案
如您的错误所示,explode
需要一个分隔符来拆分字符串.使用 str_split
代替:
As indicated by your error, explode
requires a delimiter to split the string. Use str_split
instead:
$arr = str_split('testing');
输出
Array
(
[0] => t
[1] => e
[2] => s
[3] => t
[4] => i
[5] => n
[6] => g
)
这篇关于php爆炸所有字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文