1Alternative array syntax
2-----
3<?php
4
5$a{'b'};
6$a{'b'}();
7$a->b{'c'};
8$a->b(){'c'};
9A::$b{'c'};
10A{0};
11A::B{0};
12new $array{'className'};
13new $a->b{'c'}();
14-----
15!!version=7.4
16array(
17    0: Stmt_Expression(
18        expr: Expr_ArrayDimFetch(
19            var: Expr_Variable(
20                name: a
21            )
22            dim: Scalar_String(
23                value: b
24            )
25        )
26    )
27    1: Stmt_Expression(
28        expr: Expr_FuncCall(
29            name: Expr_ArrayDimFetch(
30                var: Expr_Variable(
31                    name: a
32                )
33                dim: Scalar_String(
34                    value: b
35                )
36            )
37            args: array(
38            )
39        )
40    )
41    2: Stmt_Expression(
42        expr: Expr_ArrayDimFetch(
43            var: Expr_PropertyFetch(
44                var: Expr_Variable(
45                    name: a
46                )
47                name: Identifier(
48                    name: b
49                )
50            )
51            dim: Scalar_String(
52                value: c
53            )
54        )
55    )
56    3: Stmt_Expression(
57        expr: Expr_ArrayDimFetch(
58            var: Expr_MethodCall(
59                var: Expr_Variable(
60                    name: a
61                )
62                name: Identifier(
63                    name: b
64                )
65                args: array(
66                )
67            )
68            dim: Scalar_String(
69                value: c
70            )
71        )
72    )
73    4: Stmt_Expression(
74        expr: Expr_ArrayDimFetch(
75            var: Expr_StaticPropertyFetch(
76                class: Name(
77                    name: A
78                )
79                name: VarLikeIdentifier(
80                    name: b
81                )
82            )
83            dim: Scalar_String(
84                value: c
85            )
86        )
87    )
88    5: Stmt_Expression(
89        expr: Expr_ArrayDimFetch(
90            var: Expr_ConstFetch(
91                name: Name(
92                    name: A
93                )
94            )
95            dim: Scalar_Int(
96                value: 0
97            )
98        )
99    )
100    6: Stmt_Expression(
101        expr: Expr_ArrayDimFetch(
102            var: Expr_ClassConstFetch(
103                class: Name(
104                    name: A
105                )
106                name: Identifier(
107                    name: B
108                )
109            )
110            dim: Scalar_Int(
111                value: 0
112            )
113        )
114    )
115    7: Stmt_Expression(
116        expr: Expr_New(
117            class: Expr_ArrayDimFetch(
118                var: Expr_Variable(
119                    name: array
120                )
121                dim: Scalar_String(
122                    value: className
123                )
124            )
125            args: array(
126            )
127        )
128    )
129    8: Stmt_Expression(
130        expr: Expr_New(
131            class: Expr_ArrayDimFetch(
132                var: Expr_PropertyFetch(
133                    var: Expr_Variable(
134                        name: a
135                    )
136                    name: Identifier(
137                        name: b
138                    )
139                )
140                dim: Scalar_String(
141                    value: c
142                )
143            )
144            args: array(
145            )
146        )
147    )
148)
149-----
150<?php
151
152$a{'b'};
153$a{'b'}();
154$a->b{'c'};
155$a->b(){'c'};
156A::$b{'c'};
157A{0};
158A::B{0};
159new $array{'className'};
160new $a->b{'c'}();
161-----
162Syntax error, unexpected '{' from 3:3 to 3:3
163Syntax error, unexpected '{' from 4:3 to 4:3
164Syntax error, unexpected '{' from 5:6 to 5:6
165Syntax error, unexpected '{' from 6:8 to 6:8
166Syntax error, unexpected '{' from 7:6 to 7:6
167Syntax error, unexpected '{' from 8:2 to 8:2
168Syntax error, unexpected '{' from 9:5 to 9:5
169Syntax error, unexpected '{' from 10:11 to 10:11
170Syntax error, unexpected '{' from 11:10 to 11:10
171array(
172    0: Stmt_Expression(
173        expr: Expr_Variable(
174            name: a
175        )
176    )
177    1: Stmt_Block(
178        stmts: array(
179            0: Stmt_Expression(
180                expr: Scalar_String(
181                    value: b
182                )
183            )
184        )
185    )
186    2: Stmt_Expression(
187        expr: Expr_Variable(
188            name: a
189        )
190    )
191    3: Stmt_Block(
192        stmts: array(
193            0: Stmt_Expression(
194                expr: Scalar_String(
195                    value: b
196                )
197            )
198        )
199    )
200    4: Stmt_Expression(
201        expr: Expr_PropertyFetch(
202            var: Expr_Variable(
203                name: a
204            )
205            name: Identifier(
206                name: b
207            )
208        )
209    )
210    5: Stmt_Block(
211        stmts: array(
212            0: Stmt_Expression(
213                expr: Scalar_String(
214                    value: c
215                )
216            )
217        )
218    )
219    6: Stmt_Expression(
220        expr: Expr_MethodCall(
221            var: Expr_Variable(
222                name: a
223            )
224            name: Identifier(
225                name: b
226            )
227            args: array(
228            )
229        )
230    )
231    7: Stmt_Block(
232        stmts: array(
233            0: Stmt_Expression(
234                expr: Scalar_String(
235                    value: c
236                )
237            )
238        )
239    )
240    8: Stmt_Expression(
241        expr: Expr_StaticPropertyFetch(
242            class: Name(
243                name: A
244            )
245            name: VarLikeIdentifier(
246                name: b
247            )
248        )
249    )
250    9: Stmt_Block(
251        stmts: array(
252            0: Stmt_Expression(
253                expr: Scalar_String(
254                    value: c
255                )
256            )
257        )
258    )
259    10: Stmt_Expression(
260        expr: Expr_ConstFetch(
261            name: Name(
262                name: A
263            )
264        )
265    )
266    11: Stmt_Block(
267        stmts: array(
268            0: Stmt_Expression(
269                expr: Scalar_Int(
270                    value: 0
271                )
272            )
273        )
274    )
275    12: Stmt_Expression(
276        expr: Expr_ClassConstFetch(
277            class: Name(
278                name: A
279            )
280            name: Identifier(
281                name: B
282            )
283        )
284    )
285    13: Stmt_Block(
286        stmts: array(
287            0: Stmt_Expression(
288                expr: Scalar_Int(
289                    value: 0
290                )
291            )
292        )
293    )
294    14: Stmt_Expression(
295        expr: Expr_New(
296            class: Expr_Variable(
297                name: array
298            )
299            args: array(
300            )
301        )
302    )
303    15: Stmt_Block(
304        stmts: array(
305            0: Stmt_Expression(
306                expr: Scalar_String(
307                    value: className
308                )
309            )
310        )
311    )
312    16: Stmt_Expression(
313        expr: Expr_New(
314            class: Expr_PropertyFetch(
315                var: Expr_Variable(
316                    name: a
317                )
318                name: Identifier(
319                    name: b
320                )
321            )
322            args: array(
323            )
324        )
325    )
326    17: Stmt_Block(
327        stmts: array(
328            0: Stmt_Expression(
329                expr: Scalar_String(
330                    value: c
331                )
332            )
333        )
334    )
335)
336