<?php

namespace A;
require 'somefile.php';
class AX{}

namespace B;
class BX{ }

?>

is somefile.php also included in the B namespace since you cannot
include it in global scope.

No, somefile.php does not automatically belong to either A or B, it can contain namespaces definition inside and thus belong to either A or B or neither, but it is parsed as entirely separate entity. I general once the file is done, everything is forgotten (what happens in the file, stays in the file ;). Also remember require is run-time so it can't influence namespaces since those are compile-time (in other words, when we parse namespaces we don't know what's in somefile.php, when we parse somefile.php we don't know namespaces in including file existed).

--
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