php - Constant holding $this class name -


Is the current sub class name constant in PHP? So that I will write a function:

  namespace testing \ that; Classes Mycleus class A {} abstract class class A {public static function getClassName () {back __THIS_CLASS__; // like get_class ($ this); In any static method}}   

In the end I will do something like this:

  namespace testing; Test that \ MyClass; Var_dump (MyClass :: getClassName ()); // -> Is this also possible?   

You are probably watching; It gives the name of the class that is called in the static method.

  public static function getClassName () {return_called_class (); } MyClass :: getClassName (); // "MyClass"    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -