On 27.05.2010, at 10:45, Daniel Egeberg wrote: > If you don't know whether the user/database provided information you > have is correct before you pass it along to something else, I would > say that the code indeed is bad. Unless you regard "123abc" as a valid > value from your user, don't allow the user to give you that value. If > you regard it as a valid value, then it's not an int thus you wouldn't > want to type cast it in the first place.
as Arvids already pointed out most database extensions for PHP atm return strings even for integers/floats. furthermore the "123abc" example was mentioned more for data coming from external sources, with strict typing you are encouraging stuff like (int)"123abc". Of course a good programmer would first check with is_numeric() before casting. Seems like a lot of work. With the proposal of weak typing with error/notice on data loss none of that would be needed. regards, Lukas Kahwe Smith m...@pooteeweet.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php