English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP Ctype Functions

The functions provided by this extension check whether a character or string belongs to a character class based on the current locale.

When called with an integer parameter, these functions behave exactly the same as the corresponding C functions in ctype.h.

install

from PHP 4.2.0 to enable these functions by default. For earlier versions, you must use --enable-ctype Configure and compile PHP. You can use --disable-ctype Disable ctype support.

PHP 4.3.0 provides built-in support for ctype.

Function list

PHP-Indicates the earliest version of PHP that supports this function.

NumberFunction nameDescriptionPHP version
1ctype_alnum()Check alphabetic and numeric characters4.0.4
2ctype_alpha()Check alphabetic characters4.0.4
3ctype_cntrl()Check control characters4.0.4
4ctype_digit()Check numeric characters4.0.4
5ctype_graph()Check all printable characters except spaces4.0.4
6ctype_lower()Check lowercase characters4.0.4
7ctype_print()Check printable characters4.0.4
8ctype_punct()Check if the printable characters do not contain whitespace, numbers, and letters4.0.4
9ctype_space()Check space characters4.0.4
10ctype_upper()Check uppercase characters4.0.4
11ctype_xdigit()Check if the string contains only hexadecimal characters4.0.4