xref: /PHP-8.3/Zend/tests/traits/language013.phpt (revision 782352c5)
1--TEST--
2Statics work like expected for language-based copy'n'paste. No link between methods from the same trait.
3--FILE--
4<?php
5error_reporting(E_ALL);
6
7trait Counter {
8   public function inc() {
9     static $c = 0;
10     $c = $c + 1;
11     echo "$c\n";
12   }
13}
14
15
16class C1 {
17   use Counter;
18}
19
20class C2 {
21   use Counter;
22}
23
24$o = new C1();
25$o->inc();
26$o->inc();
27
28$p = new C2();
29$p->inc();
30$p->inc();
31
32?>
33--EXPECT--
341
352
361
372
38