Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Dynamically Typed:
Validation with CType
May 12, 2004 @ 12:11:33

In the latest post from Dynamically Typed, there's a new posting dealing with the standardization of the CType functions into the default PHP builds.

From this post: What happens when you take you eye off the ball? The CType extension becomes a default part of PHP!

Have to confess I've never touched them until recently and was stuck in a "validation = regular expressions" mindset. What puzzles me is I haven't seen anyone else using them either - most libraries doing some validation, including QuickForm and Validate all use regular expressions. Anyone know why? It's not hard to use them but fall back to regular expressions for older PHP versions.

The point behind the CType functions (Character Type) is to check whether a character or string falls into a certain character class according to the current locale. While the same kind of things can be accomplished with regular expressions, it's nice to be able to simply use one function with a bit more meaningful name.

tagged:

Link:


Trending Topics: