Re: Why no type hints for built-in types?
| From: | Rasmus Lerdorf | Date: | Sun, 23 Jan 2005 02:43:06 +0000 |
| Subject: | Re: Why no type hints for built-in types? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-207062@lists.php.net to get a copy of this message | ||
Terje Slettebø wrote:
I don't find this answer satisfactory. Yes, PHP has loose/weak typing, but at any one time, a value or a variable has a distinct type. In the example in the quote above, you'd have to ensure that the value you pass is of the right type.Well, like it or not, that is the way it is. PHP is first and foremost a web scripting language. Browsers don't send a type along with each bit of information they send. Everything comes across as a string and as such all the internal PHP functions do the right thing when you pass a string to a function that really takes a number. We have no plans to break this and create an inconsistent set of functions that no longer do this. -Rasmus