lsb_024.phpt 442 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. Late Static Binding static:: accesses protected / public static variables of child
  3. class when the variable is private in parent class
  4. --FILE--
  5. <?php
  6. class A {
  7. private static $value = 'A';
  8. public static function out() {
  9. echo static::$value, PHP_EOL;
  10. }
  11. }
  12. class B extends A {
  13. protected static $value = 'B';
  14. }
  15. class C extends A {
  16. public static $value = 'C';
  17. }
  18. A::out();
  19. B::out();
  20. C::out();
  21. --EXPECT--
  22. A
  23. B
  24. C