xref: /PHP-8.1/Zend/tests/objects_031.phpt (revision e0625942)
1--TEST--
2Cloning stdClass
3--FILE--
4<?php
5
6$x[] = clone new stdclass;
7$x[] = clone new stdclass;
8$x[] = clone new stdclass;
9
10$x[0]->a = 1;
11
12var_dump($x);
13
14?>
15--EXPECTF--
16array(3) {
17  [0]=>
18  object(stdClass)#%d (1) {
19    ["a"]=>
20    int(1)
21  }
22  [1]=>
23  object(stdClass)#%d (0) {
24  }
25  [2]=>
26  object(stdClass)#%d (0) {
27  }
28}
29