Re: Request for a function or constant to expose which namespace the current code is running under.

From: Date: Tue, 30 Jun 2009 17:56:40 +0000
Subject: Re: Request for a function or constant to expose which namespace the current code is running under.
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-44556@lists.php.net to get a copy of this message
Hi!
If I'm looking for a specific function, and it's in two include files, how do you know which namespace the function is written under? Some sort of manual backtrace?
Namespaces are local to files.
Is there a magic constant like __NAMESPACE__ or a function that can return the name of the namespace the code is currently running under?
"namespace the code is currently running under" is meaningless, since namespace is a compile-time concept. There is __NAMESPACE__ constant which is equal to currently compiles namespace. http://www.php.net/manual/en/language.namespaces.nsconstants.php -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#44556) next »