REFLECTIONCLASS.GETSHORTNAME(3) 1 REFLECTIONCLASS.GETSHORTNAME(3)
ReflectionClass::getShortName - Gets short name
SYNOPSIS
public string ReflectionClass::getShortName (void )
DESCRIPTION
Gets the short name of the class, the part without the namespace.
PARAMETERS
This function has no parameters.
RETURN VALUES
The class short name.
EXAMPLES
Example #1
ReflectionClass::getShortName example
<?php
namespace AB;
class Foo { }
$function = new ReflectionClass('stdClass');
var_dump($function->inNamespace());
var_dump($function->getName());
var_dump($function->getNamespaceName());
var_dump($function->getShortName());
$function = new ReflectionClass('A\B\Foo');
var_dump($function->inNamespace());
var_dump($function->getName());
var_dump($function->getNamespaceName());
var_dump($function->getShortName());
?>
The above example will output:
bool(false)
string(8) "stdClass"
string(0) ""
string(8) "stdClass"
bool(true)
string(7) "ABFoo"
string(3) "AB"
string(3) "Foo"
SEE ALSO
ReflectionClass::getName.
PHP Documentation Group REFLECTIONCLASS.GETSHORTNAME(3)