php php爆炸所有字符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9814375/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
php explode all characters
提问by qwertymk
I'm looking for the equivalent of what in js would be 'this is a string'.split('')
for PHP.
我正在寻找相当于 js'this is a string'.split('')
中 PHP 的内容。
If I try $array = explode('', 'testing');
I get an error Warning: explode() [function.explode]: Empty delimiter in
如果我尝试$array = explode('', 'testing');
我得到一个错误Warning: explode() [function.explode]: Empty delimiter in
Is there another way to do this?
有没有另一种方法可以做到这一点?
回答by Josh
回答by Mark Roach
$string = "TEST";
echo $string[0]; // This will display T
There is no need to explode it
没必要炸
回答by user3470929
TO SPLIT string into ARRAY its best to use
TO SPLIT string into ARRAY 最好用
$arr= str_split($string);