1--TEST--
2Evaluation order during assignments.
3--FILE--
4<?php
5
6function i1() {
7        echo "i1\n";
8        return 0;
9}
10
11function i2() {
12        echo "i2\n";
13        return 0;
14}
15
16function i3() {
17        echo "i3\n";
18        return 0;
19}
20
21function i4() {
22        echo "i4\n";
23        return 0;
24}
25
26function i5() {
27        echo "i5\n";
28        return 0;
29}
30
31function i6() {
32        echo "i6\n";
33        return 0;
34}
35
36$a = array(array(0));
37$b = array(array(1));
38$c = array(array(2));
39
40$a[i1()][i2()] = ($b[i3()][i4()] = $c[i5()][i6()]);
41var_dump($a);
42var_dump($b);
43var_dump($c);
44
45$a[i1()][i2()] = $b[i3()][i4()] = -$c[i5()][i6()];
46var_dump($a);
47var_dump($b);
48var_dump($c);
49
50$a[i1()][i2()] = -($b[i3()][i4()] = +($c[i5()][i6()]));
51var_dump($a);
52var_dump($b);
53var_dump($c);
54
55
56?>
57--EXPECT--
58i1
59i2
60i3
61i4
62i5
63i6
64array(1) {
65  [0]=>
66  array(1) {
67    [0]=>
68    int(2)
69  }
70}
71array(1) {
72  [0]=>
73  array(1) {
74    [0]=>
75    int(2)
76  }
77}
78array(1) {
79  [0]=>
80  array(1) {
81    [0]=>
82    int(2)
83  }
84}
85i1
86i2
87i3
88i4
89i5
90i6
91array(1) {
92  [0]=>
93  array(1) {
94    [0]=>
95    int(-2)
96  }
97}
98array(1) {
99  [0]=>
100  array(1) {
101    [0]=>
102    int(-2)
103  }
104}
105array(1) {
106  [0]=>
107  array(1) {
108    [0]=>
109    int(2)
110  }
111}
112i1
113i2
114i3
115i4
116i5
117i6
118array(1) {
119  [0]=>
120  array(1) {
121    [0]=>
122    int(-2)
123  }
124}
125array(1) {
126  [0]=>
127  array(1) {
128    [0]=>
129    int(2)
130  }
131}
132array(1) {
133  [0]=>
134  array(1) {
135    [0]=>
136    int(2)
137  }
138}
139