Home > Article > Backend Development > PHP's powerful string processing functions
Let’s list a few forgotten but very powerful string processing functions in the PHP language. I won’t give examples of their usage here. Interested friends can test them by 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 whether it only contains [A-Za-z]
ctype_cntrl -- Check for control character(s)
Check whether it only contains classes It is a character control character such as "rbt"
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 characters that can be printed out
ctype_punct -- Check for any printable character which is not whitespace or an alphanumeric character
Check whether it is a string containing only non-digits/characters /space printable characters
ctype_space -- Check for whitespace character(s)
Check whether it only contains characters and spaces such as "rbt"
ctype_upper -- Check for uppercase character(s)
Check whether All characters are English letters, and all are uppercase
ctype_xdigit -- Check for character(s) representing a hexadecimal digit
Check whether it is a hexadecimal string, which can only include "0123456789abcdef"
The above has introduced PHP's powerful string processing functions, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.