Do ctype_digit & ctype_alpha allow spaces?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Do ctype_digit & ctype_alpha allow spaces?

Post by impulse() »

My string with spaces are failing at the moment while being verified with ctype_alpha, ctype_digit & ctype_alnum. Is there any way to stop them failing or an alternative way to validate data, not using regex as I'm not great with regex.

Regards,
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

I believe they do not accept spaces. You could get around this by filtering first (e.g. str_replace() or preg_replace()). If you want regexp help this is a great place to ask.
(#10850)
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Post Reply