Im wondering what is the easiest way to know the namespace of a class in PHP. For example I want to know the namespace of RecursiveArrayIterator
.
Asked
Active
Viewed 69 times
1 Answers
1
$rc = new \ReflectionClass('CLASSPATH OR INSTANCE');
var_dump($rc->getNamespaceName());
Note: Empty string means global namespace

mpyw
- 5,526
- 4
- 30
- 36