PHP 8.4.2 Released!

ReflectionConstant::getShortName

(PHP 8 >= 8.4.0)

ReflectionConstant::getShortNameGets short name

Description

public ReflectionConstant::getShortName(): string

Gets the short name of the constant, the part without the namespace.

Parameters

This function has no parameters.

Return Values

The short name of the constant.

Examples

Example #1 ReflectionConstant::getShortName() example

<?php
namespace Foo;

const
BAR = 'bar';

echo (new
\ReflectionConstant('Foo\BAR'))->getName();
?>

The above example will output:

BAR

See Also

add a note

User Contributed Notes

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