PHP - Character Functions


Advertisements


The functions provided by this extension check whether a character or string falls into a certain character class according to the current locale.

When called with an integer argument these functions behave exactly like their C counterparts from ctype.h

Installation

Beginning with PHP 4.2.0 these functions are enabled by default. For older versions you have to configure and compile PHP with --enable-ctype. You can disable ctype support with --disable-ctype.

Builtin support for ctype is available with PHP 4.3.0.

Runtime Configuration

This extension has no configuration directives defined in php.ini.

List of Functions

PHP − indicates the earliest version of PHP that supports the function.

Sr.No Function & Description PHP
1 ctype_alnum()

Check for alphanumeric character(s)

4.0.4
2 ctype_alpha()

Check for alphabetic character(s)

4.0.4
3 ctype_cntrl()

Check for control character(s)

4.0.4
4 ctype_digit()

Check for numeric character(s)

4.0.4
5 ctype_graph()

Check for any printable character(s) except space

4.0.4
6 ctype_lower()

Check for lowercase character(s)

4.0.4
7 ctype_print()

Check for printable character(s)

4.0.4
8 ctype_punct()

Check for any printable character which is not whitespace or an alphanumeric character

4.0.4
9 ctype_space()

Check for whitespace character(s)

4.0.4
10 ctype_upper()

Check for uppercase character(s)

4.0.4
11 ctype_xdigit()

Check for character(s) representing a hexadecimal digit

4.0.4

php_function_reference.htm