The exception example is well an exception. Here you must inherit exception. That is simply how PHP works, it is an intended limitation. That said in this case you should not use Exception for your own stuff. Name it after
your library or product, like MyProductException.


Hey, i have an idea, why not use namespaces and call it MyProduct::Exception and name everything MyProduct::* - this way i won't get in conflict with global classes, oh wait ...


Right, you might want to have a class DOM because DOM means something
different for your company.


Yep, that's why i call it Company::DomDocument, and hey, everyone with a different namespace can import it in his file as "DomDocument", right? That sounds very comfortable to me. *sigh*


Generally you should do all your stuff in a namespace and do not import
anything into the global namespace.


You know that import works per File, right? There is no risk that one accidently tries to catch a MyProduct::Exception if he consciously used "import MyProduct::Exception;" in his file.

regards,
Benjamin

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to