gh8461-007.inc 547 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. $x = 0;
  3. class UniqueList
  4. {
  5. const A = 1;
  6. const B = 1;
  7. private $foo;
  8. public function __construct($b)
  9. {
  10. global $x;
  11. $x++;
  12. $this->foo = self::A + $b;
  13. }
  14. public static function foo()
  15. {
  16. global $x;
  17. $x += self::A;
  18. }
  19. }
  20. class UniqueListLast extends UniqueList
  21. {
  22. public function __construct()
  23. {
  24. parent::__construct(self::B);
  25. }
  26. public static function bar() {
  27. parent::foo();
  28. }
  29. }
  30. function test() {
  31. global $x;
  32. $x += 1;
  33. }