1、轉義函數:
addcslashes — 以 C
語言風格使用反斜線轉義字符串中的字符
addslashes —
使用反斜線引用字符串
stripcslashes —
反引用一個使用 addcslashes 轉義的字符串
stripslashes — 反引用一個引用字符串
2、數據進制、ascii 編碼轉換函數:
bin2hex —
將二進制數據轉換成十六進制表示
hex2bin —
Decodes a hexadecimally encoded binary string
chr —
返回 ascii 對應的指定字符
ord —
返回字符的 ASCII 碼值
3、字符串切割、分割、組合函數:
chunk_split —
將字符串分割成小塊
explode —
使用一個字符串分割另一個字符串
implode —
Join array elements with a string 把數組中的各個單元用某個指定的字符練成一個字符串
join —
別名 implode
str_getcsv —
解析 CSV 字符串爲一個數組(CSV 逗號分隔值)
4、字符串編碼、解碼函數:
convert_cyr_string — 將字符由一種 Cyrillic 字符轉換成另一種
convert_uudecode — 解碼一個 uuencode 編碼的字符串
convert_uuencode — 使用 uuencode 編碼一個字符串
5、字符串散列、加密函數:
crypt — 單向字符串散列
md5_file — 計算指定文件的 MD5 散列值
md5 — 計算字符串的 MD5 散列值
sha1_file — 計算文件的 sha1 散列值
sha1 — 計算字符串的 sha1 散列值
6、格式化字符串、轉換HTML特殊字符串函數:
ltrim — 刪除字符串開頭的空白字符(或其他字符)
rtrim —
刪除字符串末端的空白字符(或者其他字符)
html_entity_decode — Convert all HTML entities to their applicable characters
htmlentities — Convert all applicable characters to HTML entities
htmlspecialchars_decode — 將特殊的 HTML 實體轉換回普通字符
htmlspecialchars — Convert special characters to HTML entities
nl2br —
在字符串所有新行之前插入 HTML 換行標記
strip_tags — 從字符串中去除 HTML 和 PHP 標記
vfprintf — 將格式化字符串寫入流
vprintf — 輸出格式化字符串
vsprintf — 返回格式化字符串
7、數字格式化函數:
number_format —
Format a number with grouped thousands(以千爲一組格式化數字)
8、字符串替換函數:
str_replace —
子字符串替換 str_replace ( mixed $search
, mixed $replace
, mixed $subject
[, int &$count
]
)
str_ireplace — str_replace 的忽略大小寫版本
str_pad — 使用另一個字符串填充字符串爲指定長度
str_repeat — 重複一個字符串
substr_replace —
替換字符串的子串
substr —
返回字符串的子串
9、查找特定字符串函數:
strstr — 查找字符串的首次出現
strchr —
別名 strstr
strpos —
查找字符串首次出現的位置
stripos —
查找字符串首次出現的位置(不區分大小寫)
stristr —
strstr 函數的忽略大小寫版本
strpbrk —
在字符串中查找一組字符的任何一個字符
strrchr —
查找指定字符在字符串中的最後一次出現
strrpos —
計算指定字符串在目標字符串中最後一次出現的位置
strripos —
計算指定字符串在目標字符串中最後一次出現的位置(不區分大小寫)
10、計算字符串長度函數:
strlen —
獲取字符串長度
strspn —
計算字符串中全部字符都存在於指定字符集合中的第一段子串的長度。
11、字符串比較函數:
strnatcasecmp —
使用“自然順序”算法比較字符串(不區分大小寫)
strnatcmp —
使用自然排序算法比較字符串
strncasecmp —
二進制安全比較字符串開頭的若干個字符(不區分大小寫)
strncmp —
二進制安全比較字符串開頭的若干個字符
substr_compare —
二進制安全比較字符串(從偏移位置比較指定長度)
12、字符串轉換函數:
strtolower — 將字符串轉化爲小寫
strtoupper — 將字符串轉化爲大寫
strtr —
轉換指定字符
ucfirst —
將字符串的首字母轉換爲大寫
ucwords —
將字符串中每個單詞的首字母轉換爲大寫
str_shuffle — 隨機打亂一個字符串
str_split — 將字符串轉換爲數組