Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / spl / tests / arrayObject_clone_basic1.phpt
blobdd4abf3ffb62b9d2b1d0e20c1858863cce2d893f
1 --TEST--
2 SPL: Cloning an instance of ArrayObject which wraps an array. 
3 --FILE--
4 <?php
5 $a = array(1,2);
6 $aa1 =  new ArrayObject($a);
7 $a['p1'] = 'new element added to a before clone';
9 $aa2 = clone $aa1;
11 $a['p2'] = 'new element added to a after clone';
12 $aa1['new.aa1'] = 'new element added to aa1';
13 $aa2['new.aa2'] = 'new element added to aa2';
14 var_dump($a, $aa1, $aa2);
16 --EXPECTF--
17 array(4) {
18   [0]=>
19   int(1)
20   [1]=>
21   int(2)
22   ["p1"]=>
23   string(35) "new element added to a before clone"
24   ["p2"]=>
25   string(34) "new element added to a after clone"
27 object(ArrayObject)#1 (1) {
28   ["storage":"ArrayObject":private]=>
29   array(3) {
30     [0]=>
31     int(1)
32     [1]=>
33     int(2)
34     ["new.aa1"]=>
35     string(24) "new element added to aa1"
36   }
38 object(ArrayObject)#2 (1) {
39   ["storage":"ArrayObject":private]=>
40   array(3) {
41     [0]=>
42     int(1)
43     [1]=>
44     int(2)
45     ["new.aa2"]=>
46     string(24) "new element added to aa2"
47   }