1Array/string dereferencing
2-----
3<?php
4
5"abc"[2];
6"abc"[2][0][0];
7
8[1, 2, 3][2];
9[1, 2, 3][2][0][0];
10
11array(1, 2, 3)[2];
12array(1, 2, 3)[2][0][0];
13
14FOO[0];
15Foo::BAR[1];
16$foo::BAR[2][1][0];
17-----
18array(
19    0: Stmt_Expression(
20        expr: Expr_ArrayDimFetch(
21            var: Scalar_String(
22                value: abc
23            )
24            dim: Scalar_Int(
25                value: 2
26            )
27        )
28    )
29    1: Stmt_Expression(
30        expr: Expr_ArrayDimFetch(
31            var: Expr_ArrayDimFetch(
32                var: Expr_ArrayDimFetch(
33                    var: Scalar_String(
34                        value: abc
35                    )
36                    dim: Scalar_Int(
37                        value: 2
38                    )
39                )
40                dim: Scalar_Int(
41                    value: 0
42                )
43            )
44            dim: Scalar_Int(
45                value: 0
46            )
47        )
48    )
49    2: Stmt_Expression(
50        expr: Expr_ArrayDimFetch(
51            var: Expr_Array(
52                items: array(
53                    0: ArrayItem(
54                        key: null
55                        value: Scalar_Int(
56                            value: 1
57                        )
58                        byRef: false
59                        unpack: false
60                    )
61                    1: ArrayItem(
62                        key: null
63                        value: Scalar_Int(
64                            value: 2
65                        )
66                        byRef: false
67                        unpack: false
68                    )
69                    2: ArrayItem(
70                        key: null
71                        value: Scalar_Int(
72                            value: 3
73                        )
74                        byRef: false
75                        unpack: false
76                    )
77                )
78            )
79            dim: Scalar_Int(
80                value: 2
81            )
82        )
83    )
84    3: Stmt_Expression(
85        expr: Expr_ArrayDimFetch(
86            var: Expr_ArrayDimFetch(
87                var: Expr_ArrayDimFetch(
88                    var: Expr_Array(
89                        items: array(
90                            0: ArrayItem(
91                                key: null
92                                value: Scalar_Int(
93                                    value: 1
94                                )
95                                byRef: false
96                                unpack: false
97                            )
98                            1: ArrayItem(
99                                key: null
100                                value: Scalar_Int(
101                                    value: 2
102                                )
103                                byRef: false
104                                unpack: false
105                            )
106                            2: ArrayItem(
107                                key: null
108                                value: Scalar_Int(
109                                    value: 3
110                                )
111                                byRef: false
112                                unpack: false
113                            )
114                        )
115                    )
116                    dim: Scalar_Int(
117                        value: 2
118                    )
119                )
120                dim: Scalar_Int(
121                    value: 0
122                )
123            )
124            dim: Scalar_Int(
125                value: 0
126            )
127        )
128    )
129    4: Stmt_Expression(
130        expr: Expr_ArrayDimFetch(
131            var: Expr_Array(
132                items: array(
133                    0: ArrayItem(
134                        key: null
135                        value: Scalar_Int(
136                            value: 1
137                        )
138                        byRef: false
139                        unpack: false
140                    )
141                    1: ArrayItem(
142                        key: null
143                        value: Scalar_Int(
144                            value: 2
145                        )
146                        byRef: false
147                        unpack: false
148                    )
149                    2: ArrayItem(
150                        key: null
151                        value: Scalar_Int(
152                            value: 3
153                        )
154                        byRef: false
155                        unpack: false
156                    )
157                )
158            )
159            dim: Scalar_Int(
160                value: 2
161            )
162        )
163    )
164    5: Stmt_Expression(
165        expr: Expr_ArrayDimFetch(
166            var: Expr_ArrayDimFetch(
167                var: Expr_ArrayDimFetch(
168                    var: Expr_Array(
169                        items: array(
170                            0: ArrayItem(
171                                key: null
172                                value: Scalar_Int(
173                                    value: 1
174                                )
175                                byRef: false
176                                unpack: false
177                            )
178                            1: ArrayItem(
179                                key: null
180                                value: Scalar_Int(
181                                    value: 2
182                                )
183                                byRef: false
184                                unpack: false
185                            )
186                            2: ArrayItem(
187                                key: null
188                                value: Scalar_Int(
189                                    value: 3
190                                )
191                                byRef: false
192                                unpack: false
193                            )
194                        )
195                    )
196                    dim: Scalar_Int(
197                        value: 2
198                    )
199                )
200                dim: Scalar_Int(
201                    value: 0
202                )
203            )
204            dim: Scalar_Int(
205                value: 0
206            )
207        )
208    )
209    6: Stmt_Expression(
210        expr: Expr_ArrayDimFetch(
211            var: Expr_ConstFetch(
212                name: Name(
213                    name: FOO
214                )
215            )
216            dim: Scalar_Int(
217                value: 0
218            )
219        )
220    )
221    7: Stmt_Expression(
222        expr: Expr_ArrayDimFetch(
223            var: Expr_ClassConstFetch(
224                class: Name(
225                    name: Foo
226                )
227                name: Identifier(
228                    name: BAR
229                )
230            )
231            dim: Scalar_Int(
232                value: 1
233            )
234        )
235    )
236    8: Stmt_Expression(
237        expr: Expr_ArrayDimFetch(
238            var: Expr_ArrayDimFetch(
239                var: Expr_ArrayDimFetch(
240                    var: Expr_ClassConstFetch(
241                        class: Expr_Variable(
242                            name: foo
243                        )
244                        name: Identifier(
245                            name: BAR
246                        )
247                    )
248                    dim: Scalar_Int(
249                        value: 2
250                    )
251                )
252                dim: Scalar_Int(
253                    value: 1
254                )
255            )
256            dim: Scalar_Int(
257                value: 0
258            )
259        )
260    )
261)
262