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