$ php -a
php > echo $foo;
Notice: Undefined variable: foo in php shell code on line 1
> This is only a notice error, and PHP will happily carry on. This can be confusing for those coming from “exception-heavy” languages, because referencing a missing variable in Python for example will throw an exception:> The only real difference is that Python will freak out over any small thing, so that developers can be super sure any potential issue or edge-case is caught, whereas PHP will keep on processing unless something extreme happens, at which point it will throw an error and report it.
This is the kind of mentality that scares me about PHP. The author is saying that an undefined variable is just a small thing, nothing to be worried about and the correct behavior is not to "freak out" about it and just carry on. And only stop if something "extreme" happens.
Am I crazy to think that this is crazy? I can't think of a case where continuing with program execution after referencing an undefined variable is a good thing. Trying to use an undefined variable is a bug, a potentially very serious one, so I prefer my language to stop me from writing this bug, not just "note" it.