Skip to content
Advertisement

Get class name minus namespace without using Reflection

Is there a simple way to get the class name without the namespace without using Reflection?

This is my class and when I call get_class() I get CRMPiccoBundleServicesRFCWebhookSiteCancelled

JavaScript

Advertisement

Answer

Or simply exploding the return from class_name and getting the last element:

JavaScript

Or simply removing the namespace from the output of get_class:

JavaScript

Either works with or without namespace.

And so on.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement