int strlen ( string $string )

int mb_strlen ( string $str [, string $encoding ] )

encoding参数为字符编码。如果省略,则使用内部字符编码。


string strtolower ( string $str )

string mb_strtolower ( string $str [, string $encoding = mb_internal_encoding() ] )


int mb_strpos ( string $haystack , string $needle [, int $offset = 0 [, string $encoding ]] )


int strpos ( string $haystack , ​​mixed​​ $needle [, int $offset = 0 ] )



1 2 3 4 5 6 7 8

​<?php​​​​header(​​​​"content-type:text/html; charset=utf-8"​​​​);​​​​echo​​​​strlen​​​​(​​​​"我是strlen!"​​​​);​​​​echo​​​​"<br/>"​​​​;​​​​echo​​​​mb_strlen(​​​​"我是mb_strlen!"​​​​,​​​​"utf8"​​​​);​​​​?><br>​​​​//分别输出3和1;​


带mb的函数并不是PHP内置函数,需要修改php.ini,开启 php_mbstring

mb是Multibyte的简写,用来处理多字节的,一般汉语,韩语,日语中用替换的话,一般用mb_replace,然后指定字符集;


带mb的函数并不是PHP内置函数,需要修改php.ini,开启 php_mbstring

mb是Multibyte的简写,用来处理多字节的,一般汉语,韩语,日语中用替换的话,一般用mb_replace,然后指定字符集;




int strlen ( string $string )

int mb_strlen ( string $str [, string $encoding ] )

encoding参数为字符编码。如果省略,则使用内部字符编码。


string strtolower ( string $str )

string mb_strtolower ( string $str [, string $encoding = mb_internal_encoding() ] )


int mb_strpos ( string $haystack , string $needle [, int $offset = 0 [, string $encoding ]] )


int strpos ( string $haystack , ​​mixed​​ $needle [, int $offset = 0 ] )



1 2 3 4 5 6 7 8

​<?php​​​​header(​​​​"content-type:text/html; charset=utf-8"​​​​);​​​​echo​​​​strlen​​​​(​​​​"我是strlen!"​​​​);​​​​echo​​​​"<br/>"​​​​;​​​​echo​​​​mb_strlen(​​​​"我是mb_strlen!"​​​​,​​​​"utf8"​​​​);​​​​?><br>​​​​//分别输出3和1;​


带mb的函数并不是PHP内置函数,需要修改php.ini,开启 php_mbstring

mb是Multibyte的简写,用来处理多字节的,一般汉语,韩语,日语中用替换的话,一般用mb_replace,然后指定字符集;




int strlen ( string $string )

int mb_strlen ( string $str [, string $encoding ] )

encoding参数为字符编码。如果省略,则使用内部字符编码。


string strtolower ( string $str )

string mb_strtolower ( string $str [, string $encoding = mb_internal_encoding() ] )


int mb_strpos ( string $haystack , string $needle [, int $offset = 0 [, string $encoding ]] )


int strpos ( string $haystack , ​​mixed​$needle [, int $offset = 0 ] )



1 2 3 4 5 6 7 8

​<?php​​​​header(​​​​"content-type:text/html; charset=utf-8"​​​​);​​​​echo​​​​strlen​​​​(​​​​"我是strlen!"​​​​);​​​​echo​​​​"<br/>"​​​​;​​​​echo​​​​mb_strlen(​​​​"我是mb_strlen!"​​​​,​​​​"utf8"​​​​);​​​​?><br>​​​​//分别输出3和1;​


带mb的函数并不是PHP内置函数,需要修改php.ini,开启 php_mbstring

mb是Multibyte的简写,用来处理多字节的,一般汉语,韩语,日语中用替换的话,一般用mb_replace,然后指定字符集;



带mb的函数并不是PHP内置函数,需要修改php.ini,开启 php_mbstring

mb是Multibyte的简写,用来处理多字节的,一般汉语,韩语,日语中用替换的话,一般用mb_replace,然后指定字符集;



int strlen ( string $string )

int mb_strlen ( string $str [, string $encoding ] )

encoding参数为字符编码。如果省略,则使用内部字符编码。


string strtolower ( string $str )

string mb_strtolower ( string $str [, string $encoding = mb_internal_encoding() ] )


int mb_strpos ( string $haystack , string $needle [, int $offset = 0 [, string $encoding ]] )


int strpos ( string $haystack , ​​mixed​$needle [, int $offset = 0 ] )



1 2 3 4 5 6 7 8

​<?php​​​​header(​​​​"content-type:text/html; charset=utf-8"​​​​);​​​​echo​​​​strlen​​​​(​​​​"我是strlen!"​​​​);​​​​echo​​​​"<br/>"​​​​;​​​​echo​​​​mb_strlen(​​​​"我是mb_strlen!"​​​​,​​​​"utf8"​​​​);​​​​?><br>​​​​//分别输出3和1;​


带mb的函数并不是PHP内置函数,需要修改php.ini,开启 php_mbstring

mb是Multibyte的简写,用来处理多字节的,一般汉语,韩语,日语中用替换的话,一般用mb_replace,然后指定字符集;