xref: /PHP-7.4/Zend/tests/anon/003.phpt (revision d679f022)
1--TEST--
2reusing anonymous classes
3--FILE--
4<?php
5while (@$i++<10) {
6    var_dump(new class($i) {
7
8        public function __construct($i) {
9            $this->i = $i;
10        }
11    });
12}
13--EXPECTF--
14object(class@%s)#1 (1) {
15  ["i"]=>
16  int(1)
17}
18object(class@%s)#1 (1) {
19  ["i"]=>
20  int(2)
21}
22object(class@%s)#1 (1) {
23  ["i"]=>
24  int(3)
25}
26object(class@%s)#1 (1) {
27  ["i"]=>
28  int(4)
29}
30object(class@%s)#1 (1) {
31  ["i"]=>
32  int(5)
33}
34object(class@%s)#1 (1) {
35  ["i"]=>
36  int(6)
37}
38object(class@%s)#1 (1) {
39  ["i"]=>
40  int(7)
41}
42object(class@%s)#1 (1) {
43  ["i"]=>
44  int(8)
45}
46object(class@%s)#1 (1) {
47  ["i"]=>
48  int(9)
49}
50object(class@%s)#1 (1) {
51  ["i"]=>
52  int(10)
53}
54