【www.gdgbn.com--php函数】

php教程 ctype函数应用与总结
今天翻php的文档  偶然看到ctype函数   觉得很好用  记录下来以备后用:


ctype_alnum -- check for alphanumeric character(s)
检测是否是只包含[a-za-z0-9]

ctype_alpha -- check for alphabetic character(s)
检测是否是只包含[a-za-z]


ctype_cntrl -- check for control character(s)
检查是否是只包含类是“nrt”之类的字 符控制字符


ctype_digit -- check for numeric character(s)
检查时候是只包含数字字符的字符串(0-9)


ctype_graph -- check for any printable character(s) except space
检查是否是只包含有可以打印出来的字符(除了空格)的字符串


ctype_lower -- check for lowercase character(s)
检查是否所有的字符都是英文字母,并且都是小写的


ctype_print -- check for printable character(s)
检查是否是只包含有可以打印出来的字符的字符串


ctype_punct -- check for any printable character which is not whitespace or an alphanumeric character
检查是否是只包含非数字/字符/空格的可打印出来的字符


ctype_space -- check for whitespace character(s)
检查是否是只包含类是“ ”之类的字符和空格


ctype_upper -- check for uppercase character(s)
检查是否所有的字符都是英文字母,并且都是大写的


ctype_xdigit -- check for character(s) representing a hexadecimal digit
检查是否是16进制的字符串,只能包括 “0123456789abcdef”

 

ctype 函数
table of contents
ctype_alnum — check for alphanumeric character(s)   检查字符串中只包含数字或字母,相当于正则[a-za-z0-9].   有返回值。
ctype_alpha — check for alphabetic character(s)  检查字符串中只包含字母。  有返回值。
ctype_cntrl — check for control character(s)    检查字符串中是否只包含" "n" "r" "t" " 这样的控制字符。  有返回值
ctype_digit — check for numeric character(s)  检查字符串中是否只包含数字。  有返回值。
ctype_graph — check for any printable character(s) except space  检查字符串中是否只包含可以输出的字符。 有返回值。
ctype_lower — check for lowercase character(s)   检查字符串中是否只包含小写的英文字母。   有返回值。
ctype_print — check for printable character(s)  检查字符串中是否只包含可以打印的字符。   有返回值。
ctype_punct — check for any printable character which is not whitespace or an alphanumeric character  检查字符串中是否只包含可以打印的字符,并且这样字符不能是非空格、数字、字符。    有返回值。
ctype_space — check for whitespace character(s)   检查字符串中是否只包含空格或者" " .  有返回值
ctype_upper — check for uppercase character(s)  检查字符串中是否只包含大写的英文字母。  有返回值。
ctype_xdigit — check for character(s) representing a hexadecimal digit  检查字符串中是否是16进制的字符串。

本文来源:http://www.gdgbn.com/jiaocheng/29633/