4 ms·
PHP Strict Typing
- rurban 9y agoA type violation is a run-time exception, not a compile-time error? Cannot believe this.
- eamann 9y agoPHP isn't a compiled language. Exceptions are thrown when the code is loaded into the interpreter and said interpreter notices the error.
- rurban 9y agoNo, that is not how it works. PHP is not AST interpreted anymore, there is a distinction between compile-time and run-time. And this error is compile-time, otherwise it would make no sense at all.
- eamann 9y agoYes and no. This is a PHP Fatal Error, which will cause execution to stop. But the compiler doesn't compile the entire file in the same way you'd see with other languages. Any code in a PHP file _before_ the type error will still execute just fine, but when the PHP engine hits the error it will fatal and throw a TypeError (along with a stack trace, depending on the verbosity of your configuration).