php 字符串分割几种方式

        $str = str_replace("\\","/",__FILE__);
var_dump($str);

var_dump(split("/",$str));

var_dump(preg_split("/\//",$str));

var_dump(explode("/",$str));

var_dump(chunk_split($str,10));

var_dump(wordwrap(str_replace("\\"," ",__FILE__),10,"\r\n")); //wordwrap 是按照词语分割,句子要有空格

var_dump(str_split($str,10));
var_dump(implode("\r\n",str_split($str,10)));

你可能感兴趣的:(PHP)