hosted by liquidweb


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

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
  #1  
Old 06-27-2003, 03:11 PM
hostgrid hostgrid is offline
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

thanks,
Matt

__________________
Regards,
Matt Fogleman AIM: HstGrid
The Host-Grid team
http://www.host-grid.com/

Reply With Quote


Sponsored Links
  #2  
Old 06-27-2003, 03:23 PM
plugged plugged is offline
Junior Guru
 
Join Date: Dec 2002
Posts: 246
PHP Code:
function is_char($chr) {
  return 
ereg([a-zA-Z],$chr);


Reply With Quote
  #3  
Old 06-27-2003, 03:47 PM
Lagniappe-labgeek Lagniappe-labgeek is offline
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

http://www.php.net/manual/en/ref.ctype.php

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.
Reply With Quote
Sponsored Links
  #4  
Old 06-27-2003, 03:50 PM
hostgrid hostgrid is offline
Junior Guru Wannabe
 
Join Date: Dec 2002
Posts: 53
Thanks fellas, I got it!

__________________
Regards,
Matt Fogleman AIM: HstGrid
The Host-Grid team
http://www.host-grid.com/

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Microsoft and AT&T Partnership Adds VPN to Windows Azure Web Hosting News 2013-09-20 10:39:32
Arbor Networks Adds to Peakflow Hosting Provider Anti-DDoS Platform Web Hosting News 2013-01-10 13:31:21
Liquid Web Updates Block Storage, Adding Scale, Cross Mounting Web Hosting News 2012-12-14 16:17:44
VIDEO: WebsPlanet, Hostway talk Website Building Software Partnership Whir Tv 2014-05-02 14:54:09
Rackspace Details New Cloud Hosting Control Panel Features Web Hosting News 2012-08-03 16:03:35


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
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com 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?