Guest User

Untitled

a guest
Oct 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <?php
  2.  
  3. class A
  4. {
  5.  
  6. static public $name = 'zir4onah';
  7.  
  8. static public function name()
  9. {
  10. return static::$name;
  11. }
  12. }
  13. class B extends A
  14. {
  15. static public $name = 'qwe';
  16.  
  17. public function getName()
  18. {
  19. return B::name();
  20. }
  21. }
  22. /** If STATIC:: return static::$name; i can return B::name = 'qwe' else if SELF:: return self::$name; return 'zir4onah' */
  23. $a = new B();
  24. $x = B::name(); // return qwe because static::$name;
  25. $b = $a->getName();
Add Comment
Please, Sign In to add comment