strlen

返回字符串的字节数

strtoupper、strtolower

转换成大写或小写

ucfirst

首字符大写

ucwords

ucwords ( string $str [, string $delimiters = " \t\r\n\f\v" ] ) : string

每个单词首字母大写

strcmp、strcasecmp

strcmp ( string $str1 , string $str2 ) : int

字符串的比较,按照ascll码来比较字符串的大小
0-9<a-z<a-z
如果 $s1 大于 $s2, 返回值:正数 》 1
如果 $s1 等于 $s2, 返回值:0
如果 $s1 小于 $s2, 返回值:负数 《 -1

substr

substr ( string $string , int $start [, int $length ] ) : string

字符串截取

strpos

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

查找一个字符串在另一个字符串中第一次出现的位置

str_replace,str_ireplace

str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] ) : mixed

查找替换

str_pad

str_pad ( string $input , int $pad_length [, string $pad_string = " " [, int $pad_type = str_pad_right ]] ) : string

填充函数

str_repeat

str_repeat ( string $input , int $multiplier ) : string

重复函数

strrev

字符串反转

substr_compare

substr_compare ( string $main_str , string $str , int $offset [, int $length [, bool $case_insensitivity = false ]] ) : int

截取比较
compare main_str from position offset with str up to length characters.

md5

md5 ( string $str [, bool $raw_output = false ] ) : string

md5加密
非对称性的,不可逆,能加密,不能转变回来
不管对多少位的字符串,都是加密成32位 字符和数字组成的字符串

base64_encode、base64_decode

base64加密与解密

addslashes

  • single quote (‘)
  • double quote (“)
  • backslash ()
  • nul (the nul byte)

转义函数,自动的给某些特殊的字符加上转义符号,不会转义$符号
返回字符串,该字符串为了数据库查询语句等的需要在某些字符前加上了反斜线

stripslashes

反转义函数,自动去掉转义符号
用在从数据库中取出数据的时候用的

strip_tags

strip_tags ( string $str [, mixed $allowable_tags ] ) : string

从字符中去除html和php的标记,只保留内容