background image

PHP 常用函数大全
字符串函数

(important)

addcslashes 

– 像 C 语言一样使用反斜线转义字符串中的字符 

addslashes -- 使用反斜线引用字符串 
★bin2hex --  将二进制数据转换成十六进制表示 
chop -- rtrim() 的别名函数 
★★chr -- 返回相对应于 ascii 码值所指定的单个字符。
chunk_split -- 将字符串分割成小块 
convert_cyr_string --  将字符由一种 Cyrillic 字符转换成另一种 
convert_uudecode --  Decode a uuencoded string 
convert_uuencode --  Uuencode a string 
count_chars --  返回字符串所用字符的信息 
crc32 -- 计算一个字符串的 crc32 多项式 
crypt 

– 将字符串用 DES 编码加密

★★★★★echo – 输出一个或者是多个字符串
★★★★★explode -- 使用一个字符串分割另一个字符串 
fprintf 

– 格式化一个字符串并输出

get_html_translation_table --   Returns  the  translation  table  used  by  htmlspecialchars()  and 
htmlentities() 
hebrev --  Convert logical Hebrew text to visual text 
hebrevc --  Convert logical Hebrew text to visual text with newline conversion 
★★★html_entity_decode – 将所有的 HTML 实体转换成对应的字符
★★★htmlentities – 将所有的字符转换成 HTML 实体
★★★htmlspecialchars_decode --  将特定的 HTML 实体转换为相应的字符
★★★htmlspecialchars -- 将特定的字符转换成 HTML 实体
★★★★★implode – 将一个数组的所有元素连接成一个字符串
join --  implode()函数的别名
levenshtein --  Calculate Levenshtein distance between two strings 
localeconv -- Get numeric formatting information 
★★★★★ltrim --  去除一个字符串左边的空白(或者是其他的字符) 
md5_file 

– 将一个给定的文件用 MD5 编码

★★★★★md5 --  将一个给定的字符串用 MD5 编码
metaphone -- Calculate the metaphone key of a string 
money_format 

– 将一个数字按照货币的格式进行格式化 nl_langinfo --  Query language and 

locale information 
nl2br --  在字符串中插入 HTML 换行标签。
number_format -- Format a number with grouped thousands 
★★ord – 返回一个字符的 ASCII 值 
parse_str -- 解析字符串变量
★★★★print – 输出一个字符串
★★★★printf – 格式化并输出该字符串 
quoted_printable_decode --  Convert a quoted-printable string to an 8 bit string 
quotemeta -- Quote meta characters 
★★★★★rtrim -- 去除一个字符串右边的空白(或者是其他的字符)