ReflectionConstant::getNamespaceName

(PHP 8 >= 8.4.0)

ReflectionConstant::getNamespaceNameGets namespace name

Descrizione

public ReflectionConstant::getNamespaceName(): string

Gets the namespace name of the constant.

Elenco dei parametri

Questa funzione non contiene parametri.

Valori restituiti

The namespace name, or an empty string for the global namespace.

Esempi

Example #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());
}
?>

Il precedente esempio visualizzerà:

string(3) "Foo"
string(0) ""
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top