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