![]() ![]() | ![]() |
1.1 misho 1: --TEST-- 2: Statics should work in traits, too. 3: --FILE-- 4: <?php 5: error_reporting(E_ALL); 6: 7: trait Counter { 8: public function inc() { 9: static $c = 0; 10: $c = $c + 1; 11: echo "$c\n"; 12: } 13: } 14: 15: 16: class C1 { 17: use Counter; 18: } 19: 20: $o = new C1(); 21: $o->inc(); 22: $o->inc(); 23: 24: ?> 25: --EXPECTF-- 26: 1 27: 2