php explode all characters [duplicate]

☆樱花仙子☆ 提交于 2019-11-29 00:55:31

As indicated by your error, explode requires a delimiter to split the string. Use str_split instead:

$arr = str_split('testing');

Output

Array
(
    [0] => t
    [1] => e
    [2] => s
    [3] => t
    [4] => i
    [5] => n
    [6] => g
)

Use the str_split function.

$array = str_split( 'testing');
Mark Roach
$string = "TEST";

echo $string[0];  // This will display T

There is no need to explode it

TO SPLIT string into ARRAY its best to use

$arr= str_split($string);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!