Home >Backend Development >PHP Tutorial >PHP字符串函数

PHP字符串函数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 13:27:19782browse


1 strlen()

 计算字符串的长度。

 strlen('hello');

2 substr( );

  截取字符串,三个参数, string, start , length

 1) substr(string,start)-->得到以strat为起点的字符串。 

    备注:起点也是从0开始的

 2)substr(string,-1)--》如果是负数,得到原字符串尾部的一个字符串。

 

 3) substr(string, start , length) 得到指定长度的字符串。


3 explode(分隔方式,字符串,数量);  -----》implode() ,join函数相反的效果。

  分割之后返回的是一个数组。

 

  $email ='278423229@qq.com';

  $email_array = explode('@',$email);

  echo $email_array[1];


4 strtolower(); strtoupper(); 字符串大小写转换


5     

 

Statement:
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