On 09/08/2016 21:26, Fleshgrinder wrote:
An alternative approach could be to auto-load only namespaced things and
leave non-namespaced stuff alone.
It's not quite as simple as that, as examples have already shown.
# file a.php
namespace Acme\Foo;
function a() {
return 'Hello World';
}
# file b.php
namespace Acme\Foo;
function b() {
$message = a(); # this is a call to Acme\Foo\a
return strpos($message, 'Hello'); # this is a call to \strpos
}
There's no way of telling that the a() is namespaced and the strpos() is
global until *after* the autoloader has run. There *might* be a function
Acme\Foo\strpos which is autoloadable.
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php