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的標記,只保留內容
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/53107.html
標籤:PHP
上一篇:PHP中 字串定義的三種方式
下一篇:dirname(__FILE__)、basename(__FILE__)以及 dirname(dirname(__FILE__)) 在php的含義
