Home > Article > Backend Development > Some powerful string processing functions that PHP has forgotten_PHP Tutorial
It would be wrong to list some forgotten but very powerful string processing functions in the PHP language. Examples of its usage are given one by one, and interested friends can test it themselves.
(PHP 4 >= 4.0.4, PHP 5)
Function prototype bool ctype_alnum ( string text )
ctype_alnum -- Check for alphanumeric character(s)
Check whether it only contains [A-Za-z0-9]
Function prototype bool ctype_alpha ( string text )
ctype_alpha -- Check for alphabetic character(s)
Check if it only contains [A-Za-z]
ctype_cntrl -- Check for control character(s)
Check whether it only contains character control characters whose class is "rbt" and so on
ctype_digit -- Check for numeric character(s)
When checking, it is a string containing only numeric characters (0-9)
ctype_graph -- Check for any printable character(s) except space
Check if it is a string containing only printable characters (except spaces)
ctype_lower -- Check for lowercase character(s)
Check if all characters are English letters and all lowercase
ctype_print -- Check for printable character(s)
Check if it is a string containing only characters that can be printed
ctype_punct -- Check for any printable character which is not whitespace or an alphanumeric character
Check if it is a printable character containing only non-digits/characters/spaces
ctype_space -- Check for whitespace character(s)
Check whether it only contains characters such as "rbt" and spaces
ctype_upper -- Check for uppercase character(s)
Check if all characters are English letters and all uppercase
ctype_xdigit -- Check for character(s) representing a hexadecimal digit
Check whether it is a hexadecimal string, which can only include "0123456789abcdef"