xref: /PHP-7.2/ext/spl/tests/array_002.phpt (revision 610c7fbe)
1--TEST--
2SPL: ArrayObject copy constructor
3--FILE--
4<?php
5
6$array = array('1' => 'one',
7               '2' => 'two',
8               '3' => 'three');
9
10$object = new ArrayObject($array);
11$object[] = 'four';
12
13$arrayObject = new ArrayObject($object);
14
15$arrayObject[] = 'five';
16
17var_dump($arrayObject);
18
19?>
20===DONE===
21<?php exit(0); ?>
22--EXPECTF--
23object(ArrayObject)#%d (1) {
24  ["storage":"ArrayObject":private]=>
25  object(ArrayObject)#1 (1) {
26    ["storage":"ArrayObject":private]=>
27    array(5) {
28      [1]=>
29      string(3) "one"
30      [2]=>
31      string(3) "two"
32      [3]=>
33      string(5) "three"
34      [4]=>
35      string(4) "four"
36      [5]=>
37      string(4) "five"
38    }
39  }
40}
41===DONE===
42