3 ms·
>7. You can handle the situation when a class that doesn’t exist is instantiated I'm not a PHP programmer so maybe I just don't get it ... but why would you ev
by RyanMcGreal 17y ago
>7. You can handle the situation when a class that doesn’t exist is instantiated
I'm not a PHP programmer so maybe I just don't get it ... but why would you ever want to instantiate a class that doesn't exist?
- deleted 17y ago[deleted]
- pbhjpbhj 17y agoI could perhaps see it as a debugging tool, a way to catch the name and line number of a class typo?
- shaunxcode 17y agoThis is actually how frameworks like Zend require_once the file which DOES contain the class definition (and thus the ugly class names i.e. Zend_Db_Table_Row etc. that correspond to the actual directory structure). With proper namespaces most of this should go away.
- Jach 17y agoLaziness. When your web app is class-driven and you generally have need of many different classes, it's annoying to have to include them every time you want them. (And a sin to include all of them when you won't need them.)