Re: The need for strong typing...
| From: | Rasmus Lerdorf | Date: | Fri, 13 Jul 2001 02:01:45 +0000 |
| Subject: | Re: The need for strong typing... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-57667@lists.php.net to get a copy of this message | ||
The one problem with all your musings is that there is no such thing as an
integer when it comes to transferring data over http. Everything comes as
a string. What is done with these strings when they get to the
application is what matters. It's not like there is an HTML form element
like <input type=integer> or <input type=float>. All you have is <input
type=text> when it comes to users entering data and passing it to you. I
fail to see how strong typing helps you here at all. You are going to
have to apply some sort of user-space rule once you receive the data. And
that is quite easy to do with PHP.
For your specific example you simply want to use the is_numeric()
function. That will tell you definitively whether the data that came from
the user is nothing but a numeric entity.
-Rasmus