(PHP 8 >= 8.4.0)
ReflectionConstant::getNamespaceName — Gets namespace name
Gets the namespace name of the constant.
Bu işlevin bağımsız değişkeni yoktur.
The namespace name, or an empty string for the global namespace.
Örnek 1 ReflectionConstant::getNamespaceName() example
<?php
namespace Foo {
const BAR = 'bar';
var_dump((new \ReflectionConstant('Foo\BAR'))->getNamespaceName());
}
namespace {
const BAR = 'bar';
var_dump((new \ReflectionConstant('BAR'))->getNamespaceName());
}
?>
Yukarıdaki örneğin çıktısı:
string(3) "Foo" string(0) ""