xref: /PHP-7.1/Zend/tests/object_array_cast.phpt (revision 5d94ba6e)
1--TEST--
2(object) (array) and (array) (object) casts
3--FILE--
4<?php
5
6$arr = [1, 2, 3];
7var_dump((object) (array) $arr);
8var_dump($arr);
9
10$obj = (object) [1, 2, 3];
11var_dump((array) (object) $obj);
12var_dump($obj);
13
14?>
15--EXPECT--
16object(stdClass)#1 (3) {
17  [0]=>
18  int(1)
19  [1]=>
20  int(2)
21  [2]=>
22  int(3)
23}
24array(3) {
25  [0]=>
26  int(1)
27  [1]=>
28  int(2)
29  [2]=>
30  int(3)
31}
32array(3) {
33  [0]=>
34  int(1)
35  [1]=>
36  int(2)
37  [2]=>
38  int(3)
39}
40object(stdClass)#1 (3) {
41  [0]=>
42  int(1)
43  [1]=>
44  int(2)
45  [2]=>
46  int(3)
47}
48