xref: /PHP-8.0/ext/spl/tests/array_002.phpt (revision a555cc0b)
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--EXPECTF--
21object(ArrayObject)#%d (1) {
22  ["storage":"ArrayObject":private]=>
23  object(ArrayObject)#1 (1) {
24    ["storage":"ArrayObject":private]=>
25    array(5) {
26      [1]=>
27      string(3) "one"
28      [2]=>
29      string(3) "two"
30      [3]=>
31      string(5) "three"
32      [4]=>
33      string(4) "four"
34      [5]=>
35      string(4) "five"
36    }
37  }
38}
39