I take it that when I include or conditionally include, the included
file has its own namespace, if one is declared in that file. What if I
do not declare a namespace in an include file? Does this file "inherit"
the current namespace or are the contents added to the global namespace?

No, namespaces are per-file. No namespace means global namespace. Non-local namespaces can be very problematic for bytecode caches since it would not be possible to know "true" names of the classes per-file and actually same file could generate very different names.

Could this result in name conflicts when including files that have their
own import statements?

Note that import defines local (per-file) name transformation. I.e. if you do import Zend::Some::Class as Myclass, it means in this file, once you say Myclass, you actually mean Zend::Some::Class. But it should not have any effects on other files.

Does this mean that a programmer could "override" an internal PHP
function, possibly accidentally?

Yes, it would be possible to "override" internal functions in namespace. I don't think it's too much of a problem - tools can deal with it.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

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

Reply via email to