3 ms·
But improper use over something as simple as typing (at least typing as implemented by popular languages these days) _should not be a problem_. If I create a b
by MichaelGG 14y ago
But improper use over something as simple as typing (at least typing as implemented by popular languages these days) _should not be a problem_.
If I create a bug by multiplying by a string, I'd ideally find out immediately after writing it, as the background compiler/analyzer detects the problem. Saying "Oh, well, we'll just assume that an integer times a string is 0" is just... dumb.
Seriously, if a program has a bug like that, what's the point of continuing execution? What's the real-world use case for this? The only use case I can see is "people screwing around making a home page, where nothing really matters and if they make a mistake, hey, just try to go on and maybe that last line wasn't really important anyways". It's the Visual Basic "On Error Resume Next" mindset.
- zbuc 14y agoOne of my least favorite things is the behavior of undefined constants. Use an undefined constant: Get an exception? Nope. Get an empty string? Nope. PHP will put the name of the constant in the rendered HTML. Arg.
- johnny22 14y agothere would be if an error if error_reporting(E_ALL) was used. Sadly you have to manually set an exception handler if you want it as an exception :(
- FuzzyDunlop 14y agoYou might get behaviour that is a lot more difficult to spot in production when multiplying an integer by a string that starts with an integer, too. echo 10 * "300 bananas"; // 3000 Makes total sense, doesn't it? And it could easily happen if you maintained a poorly written project with crap data stashed in the database. Even the most skilled PHP developer will have some head scratching moments when things appear to work but actually don't.