PHP的爆炸中的所有字符 [英] php explode all characters

查看:75
本文介绍了PHP的爆炸中的所有字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要找的JS什么是相当于',这是一个string'.split('')为PHP。

I'm looking for the equivalent of what in js would be 'this is a string'.split('') for PHP.

如果我尝试 $阵列=爆炸('','测试'); 我得到一个错误警告:爆炸()函数。爆炸]:在空的分隔符

If I try $array = explode('', 'testing'); I get an error Warning: explode() [function.explode]: Empty delimiter in

有另一种方式来做到这一点?

Is there another way to do this?

推荐答案

正如你的错误指示,爆炸需要一个分隔符来分割字符串。使用 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆