PHP | Character Functions

PHP Character Functions


Hello folks! welcome back to a new edition of our tutorial on PHP. In this tutorial guide, we are going to be studying about the PHP Character Functions.

The PHP character functions are used for checking whether a character or string falls into a certain character class according to the current locale.

Called with an integer argument, these php functions act just like their C counterparts from ctype.h.

Installation

Beginning with PHP 4.2.0, these functions are enabled by default and so don't require any form of Installation. For older versions you have to configure and compile php with --enable-ctype. You can disable support for ctype with --disable-ctype. Built-in support for ctype is available with PHP v 4.3.0.


Runtime Configuration

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

List of Character Functions

Following is the list of character functions that are supported in PHP. PHP - indicates the earliest versions of PHP that supports these functions.

Sr.NoFunction & DescriptionPHP
1ctype_alnum()

Check for alphanumeric character(s)

4.0.4
2ctype_alpha()

Check for alphabetic character(s)

4.0.4
3ctype_cntrl()

Check for control character(s)

4.0.4
4ctype_digit()

Check for numeric character(s)

4.0.4
5ctype_graph()

Check for any printable character(s) except space

4.0.4
6ctype_lower()

Check for lowercase character(s)

4.0.4
7ctype_print()

Check for printable character(s)

4.0.4
8ctype_punct()

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

4.0.4
9ctype_space()

Check for whitespace character(s)

4.0.4
10ctype_upper()

Check for uppercase character(s)

4.0.4
11ctype_xdigit()

Check for character(s) representing a hexadecimal digit

4.0.4

In our subsequent tutorials, we are going to be discussing about the above listed built-in functions.


Alright guys! This is where we are going to be rounding up for this tutorial post. In our next tutorial, we are going to be discussing about PHP ctype_alnum() Function.

Feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.

Thanks for reading and bye for now.