Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<ReflectionConstant::getNamespaceNameReflectionConstant::getValue>
^ReflectionConstantLast updated: Mon, 26 Oct 2026

ReflectionConstant::getShortName

(PHP 8 >= 8.4.0)

ReflectionConstant::getShortName — Gets short name

Description

public function 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'))->getShortName();
?>

The above example will output:

BAR

See Also


<ReflectionConstant::getNamespaceNameReflectionConstant::getValue>
^ReflectionConstantLast updated: Mon, 26 Oct 2026