ctype() : Checking type of string

PHP ctype character checks

The ctype extension provides focused checks for strings made entirely of digits, letters, hexadecimal characters, whitespace, punctuation, printable characters, and related character classes. Pass strings explicitly in modern PHP.

$value = 'AB12';
var_dump(ctype_alnum($value));
var_dump(ctype_alpha($value));
var_dump(ctype_digit($value));
The ctype extension in PHP provides a set of functions for character type checking. It allow to determine the type of characters in a string, such as whether they are alphanumeric, alphabetic, numeric, or part of a specific character class.
FunctionDetails
ctype_alnum()Checking alphanumeric characters
ctype_alpha()Checking for alphabetic characters
ctype_xdigit()Checking for hexadecimal characters and digits
ctype_cntrl()Checking for control characters
ctype_digit()Checking for numeric characters
ctype_graph()Checking for any printable characters except space
ctype_lower()Checking for all lower case characters
ctype_print()Checking for all printable characters
ctype_punct()Checking for all punctuation characters
ctype_space()Checking for all whitespace character(s)
ctype_upper()Checking for all upper case characters


Checking User input through web Form


Subscribe to our YouTube Channel here



plus2net.com











PHP video Tutorials
✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer