PHP 8.5.0 Alpha 1 available for testing

Voting

: max(seven, zero)?
(Example: nine)

The Note You're Voting On

XyQrTw
8 years ago
To get class name without the Namespace you can use easily this trick :
<?php
namespace My\Long\Namespace;

class
MyClass {

static function
getClassName() {
return
basename(__CLASS__);
// or with get_class();
return basename(get_class());
}

}

echo
\My\Long\Namespace\MyClass::getClassName(); // Display : MyClass
?>

<< Back to user notes page

To Top