Is there a built-in static method or property to refer to a PHP class so that it will contextually be represented as a string? For example:
Instead of this:
$obj->tempFn('MyClass') //MyClass being the name of the class
I want to do this:
$obj->tempFn(MyClass) //Directly references the class name, instead of a string representation
No. But you can define a constant in your class, that contains the class name, like:
And access it like
foo::NAME.In PHP 5.5, you’ll be able to use: