1--TEST--
2Evaluation order during assignments.
3--FILE--
4<?php
5$b = "bb";
6$a = "aa";
7
8function foo()
9{
10echo "Bad call\n";
11}
12
13function baa()
14{
15echo "Good call\n";
16}
17
18$bb = "baa";
19
20$aa = "foo";
21
22$c = ${$a=$b};
23
24$c();
25
26$a1 = array("dead","dead","dead");
27$a2 = array("dead","dead","live");
28$a3 = array("dead","dead","dead");
29
30$a = array($a1,$a2,$a3);
31
32function live()
33{
34echo "Good call\n";
35}
36
37function dead()
38{
39echo "Bad call\n";
40}
41
42$i = 0;
43
44$a[$i=1][++$i]();
45
46$a = -1;
47
48function foo1()
49{
50  global $a;
51  return ++$a;
52}
53
54$arr = array(array(0,0),0);
55
56$brr = array(0,0,array(0,0,0,5),0);
57$crr = array(0,0,0,0,array(0,0,0,0,0,10),0,0);
58
59$arr[foo1()][foo1()] = $brr[foo1()][foo1()] +
60                     $crr[foo1()][foo1()];
61
62$val = $arr[0][1];
63echo "Expect 15 and get...$val\n";
64
65$x = array(array(0),0);
66function mod($b)
67{
68global $x;
69$x = $b;
70return 0;
71}
72
73$x1 = array(array(1),1);
74$x2 = array(array(2),2);
75$x3 = array(array(3),3);
76$bx = array(10);
77
78$x[mod($x1)][mod($x2)] = $bx[mod($x3)];
79
80// expecting 10,3
81
82var_dump($x);
83?>
84--EXPECT--
85Good call
86Good call
87Expect 15 and get...15
88array(2) {
89  [0]=>
90  array(1) {
91    [0]=>
92    int(10)
93  }
94  [1]=>
95  int(3)
96}
97