Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Foo{
- /...
- public static fonction getClassName(){
- return static::class;
- }
- /...
- }
- Foo::getClassName(); // return "Foo"
- ?>
- class Foo{
- static get className(){ return "Foo";}
- // ...
- // ...
- }
- Foo.className(); // get the hardcoded "Foo"
- class Foo{
- static get className(){ return someJavascriptAlreadyWayForGetClassName() ;}
- // ...
- // ...
- }
- Foo.classCame(); // get "Foo"
- function Foo() {}
- var fooInstance = new Foo();
- console.log(fooInstance.constructor.name); // logs "Foo"
Add Comment
Please, Sign In to add comment