data types in php?
Posted: Thu Aug 18, 2005 2:32 am
are there data types in php?i mean how can i know whethere an user has put a number in text box or its a string?Depending upon that i will put the value in databse.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
I can't agree enough with using is_numeric(). You will most likely find that even though a person entered a number into a form field, the PHP engine is going to see it as a string. At least is_numeric() will look at that string and determine if the characters are numbers. In this case, you really aren't worried about the type of the var, but instead the type of the content.feyd wrote:is_numeric() works well to detect if they entered a number. The ctype_ functions could help too, however they may not be installed with your php.