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

Tiffany Brown's Blog:
PHP quickie: is_numeric() versus ctype_digit()
Jul 28, 2006 @ 11:18:39

In this new post Tiffany Brown shares a "PHP quickie" with her readers - using is_numeric versus ctype_digit.

The difference is subtle, but important one. Which function you use depends on the condition for which you’re testing.

is_numeric tests whether the string in question is a number. ctype_digit(), on the other hand, tests whether the string in question contains all numeric characters.

To help alleviate the confusion, she gives some code that does var_dumps of both methods, clearly showing the difference.

tagged: is_numeric ctype_digit usage quickie tutorial is_numeric ctype_digit usage quickie tutorial

Link:


Trending Topics: