Home > Backend Development > PHP Tutorial > php 字符串瓜分几种方式

php 字符串瓜分几种方式

WBOY
Release: 2016-06-13 13:05:48
Original
903 people have browsed it

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)));

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template