hosted by liquidweb

Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : php function: ischar()

Forum Jump

php function: ischar()

Reply Post New Thread In Programming Discussion Subscription
Send news tip View All Posts Thread Tools Search this Thread Display Modes
Junior Guru Wannabe
Join Date: Dec 2002
Posts: 53

php function: ischar()

is there a php function anyone knows of that will tell me if a character is a letter?

for example if the character is '0' or 'd' or 'b' it would return TRUE but if the character was ';' or '{' then it would return FALSE


Matt Fogleman AIM: HstGrid
The Host-Grid team

Sponsored Links
Junior Guru
Join Date: Dec 2002
Posts: 246
PHP Code:
function is_char($chr) {

Web Hosting Guru
Join Date: Jul 2002
Location: The Big Easy -New Orleans
Posts: 341
ctype_alpha(sting) - true for [a-z or A-Z] checks whole string.

May also want to see the others:
ctype_alnum -- Check for alphanumeric character(s)
ctype_alpha -- Check for alphabetic character(s)
ctype_cntrl -- Check for control character(s)
ctype_digit -- Check for numeric character(s)
ctype_graph -- Check for any printable character(s) except space
ctype_lower -- Check for lowercase character(s)
ctype_print -- Check for printable character(s)
ctype_punct -- Check for any printable character which is not whitespace or an alphanumeric character
ctype_space -- Check for whitespace character(s)
ctype_upper -- Check for uppercase character(s)
ctype_xdigit -- Check for character(s) representing a hexadecimal digit

From that page --
Editors note:

CTYPE functions are always prefered, when possible, to Regular Expressions and, often, even to some equivalent str_*, is_* functions. This is because of the fact that CTYPE uses a native C library and thus processes signitificaly faster.

Maxim Maletsky
maxim at php dot net

Last edited by Lagniappe-labgeek; 06-27-2003 at 03:52 PM.
Sponsored Links
Junior Guru Wannabe
Join Date: Dec 2002
Posts: 53
Thanks fellas, I got it!

Matt Fogleman AIM: HstGrid
The Host-Grid team


Related posts from
Title Type Date Posted
GHOST Vulnerability Poses Threat to Most Linux Systems Web Hosting News 2015-01-28 11:35:05
Verizon Prepares Enterprise Cloud Customers for Up to 48 Hours of Scheduled Downtime Web Hosting News 2015-01-05 13:45:23
At Least 18 Election Websites Offline During the U.S. Midterm Elections Web Hosting News 2014-11-07 12:38:25
Security Researchers Find Apple Saving Data to iCloud Without User Consent Web Hosting News 2014-11-06 09:04:56
Microsoft and AT&T Partnership Adds VPN to Windows Azure Web Hosting News 2013-09-20 10:39:32

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Log in with your username and password

Forgot Password?
WHT Host Brief Email:

We respect your privacy. We will never sell, rent, or give away your address to any outside party, ever.

Web Hosting News:
WHT Membership
WHT Membership



Welcome to

Create your username to jump into the discussion! is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.

(4 digit year)

Already a member?