summaryrefslogtreecommitdiff
path: root/ext/spl/tests/arrayObject___construct_basic1.phpt
blob: a14166c35e306d24d83b760704252e3bd0dfacb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
--TEST--
SPL: ArrayObject::__construct basic usage.
--FILE--
<?php
echo "--> No arguments:\n";
var_dump(new ArrayObject());

echo "--> Object argument:\n";
$a = new stdClass;
$a->p = 'hello';
var_dump(new ArrayObject($a));

echo "--> Array argument:\n";
var_dump(new ArrayObject(array('key1' => 'val1')));

echo "--> Nested ArrayObject argument:\n";
var_dump(new ArrayObject(new ArrayObject($a)));
?>
--EXPECT--
--> No arguments:
object(ArrayObject)#1 (1) {
  ["storage":"ArrayObject":private]=>
  array(0) {
  }
}
--> Object argument:
object(ArrayObject)#2 (1) {
  ["storage":"ArrayObject":private]=>
  object(stdClass)#1 (1) {
    ["p"]=>
    string(5) "hello"
  }
}
--> Array argument:
object(ArrayObject)#2 (1) {
  ["storage":"ArrayObject":private]=>
  array(1) {
    ["key1"]=>
    string(4) "val1"
  }
}
--> Nested ArrayObject argument:
object(ArrayObject)#2 (1) {
  ["storage":"ArrayObject":private]=>
  object(ArrayObject)#3 (1) {
    ["storage":"ArrayObject":private]=>
    object(stdClass)#1 (1) {
      ["p"]=>
      string(5) "hello"
    }
  }
}