Tutorials Point

  Learning PHP
  Advanced PHP
  PHP Function Reference
  PHP Useful Resources
  Selected Reading

Copyright © 2014 by tutorialspoint

  Home     References     Discussion Forums     About TP  

PHP Character Functions


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


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.

Function Description PHP
ctype_alnum() Check for alphanumeric character(s) 4.0.4
ctype_alpha() Check for alphabetic character(s) 4.0.4
ctype_cntrl() Check for control character(s) 4.0.4
ctype_digit() Check for numeric character(s) 4.0.4
ctype_graph() Check for any printable character(s) except space 4.0.4
ctype_lower() Check for lowercase character(s) 4.0.4
ctype_print() Check for printable character(s) 4.0.4
ctype_punct() Check for any printable character which is not whitespace or an alphanumeric character 4.0.4
ctype_space() Check for whitespace character(s) 4.0.4
ctype_upper() Check for uppercase character(s) 4.0.4
ctype_xdigit() Check for character(s) representing a hexadecimal digit 4.0.4

previous Printer Friendly