xref: /PHP-8.1/Zend/tests/anon/015.phpt (revision 9a1da9f6)
1--TEST--
2static variables in methods inherited from parent class
3--FILE--
4<?php
5class C {
6    function foo ($y = null) {
7        static $x = null;
8        if (!is_null($y)) {
9            $x = [$y];
10        }
11        return $x;
12    }
13}
14$c = new C();
15$c->foo(42);
16$d = new class extends C {};
17var_dump($d->foo());
18var_dump($d->foo(24));
19var_dump($c->foo());
20?>
21--EXPECT--
22array(1) {
23  [0]=>
24  int(42)
25}
26array(1) {
27  [0]=>
28  int(24)
29}
30array(1) {
31  [0]=>
32  int(24)
33}
34