php get class name without namespace – get a PHP class name without the use of namespace and without using reflection.
php get class name without namespace
simple function to get class name without namesapce. php get class name without namespace from string
public function getClassName() { $path = explode('\\', __CLASS__); return array_pop($path); }
return substr(strrchr(__CLASS__, "\\"), 1);
PHP get class name without namespace
public function getName() { $path = explode('\\', __CLASS__); return array_pop($path); }
php namespace class
laravel get class name
$lObjectect = $em->find(ContactRelation::class, $userId); echo get_class($lObjectect); // Some\Name\Space\Domain\Identity\ContactRelation
Don’t Miss : PHP Config Class To Store Configuration Data
I hope you get an idea about php get class name without namespace.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.