This article analyzes the usage of Ctype functions in php with examples. Share it with everyone for your reference. The specific analysis is as follows:
The Ctype function is the Ctype extension function of Php. It provides a set of functions for verifying whether the characters in the string are in the correct format. Here we mainly introduce the syntax of these string verification functions and what special functions there are. How to verify etc.
Ctype function is PHP’s built-in string body measurement function, which mainly includes the following types:
ctype_alnum -- Check for alphanumeric character(s): Check whether it only contains [A-Za-z0-9]
ctype_alpha -- Check for alphabetic character(s): Check whether it only contains [A-Za-z]
ctype_cntrl -- Check for control character(s): Check whether it only contains character control characters whose class is "nrt"
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 whether it is a string containing only printable characters (except spaces)
ctype_lower -- Check for lowercase character(s): Check whether all characters are English letters and all are lowercase
ctype_print -- Check for printable character(s): Check whether it is a string containing only printable characters
ctype_punct -- Check for any printable character which is not whitespace or an alphanumeric character: Check whether it is a printable character that only contains non-digits/characters/spaces
ctype_space -- Check for whitespace character(s): Check whether it only contains characters and spaces such as " "
ctype_upper -- Check for uppercase character(s): Check whether all characters are English letters and all are uppercasectype_xdigit -- Check for character(s) representing a hexadecimal digit: Check whether it is a hexadecimal string, which can only include "0123456789abcdef"
How to use them, go directly to the code: