xref: /PHP-Parser/test/code/parser/expr/variable.test (revision 23647573)
1Variable syntaxes
2-----
3<?php
4
5$a;
6${'a'};
7${foo()};
8$$a;
9$$$a;
10$$a['b'];
11-----
12array(
13    0: Stmt_Expression(
14        expr: Expr_Variable(
15            name: a
16        )
17    )
18    1: Stmt_Expression(
19        expr: Expr_Variable(
20            name: Scalar_String(
21                value: a
22            )
23        )
24    )
25    2: Stmt_Expression(
26        expr: Expr_Variable(
27            name: Expr_FuncCall(
28                name: Name(
29                    name: foo
30                )
31                args: array(
32                )
33            )
34        )
35    )
36    3: Stmt_Expression(
37        expr: Expr_Variable(
38            name: Expr_Variable(
39                name: a
40            )
41        )
42    )
43    4: Stmt_Expression(
44        expr: Expr_Variable(
45            name: Expr_Variable(
46                name: Expr_Variable(
47                    name: a
48                )
49            )
50        )
51    )
52    5: Stmt_Expression(
53        expr: Expr_ArrayDimFetch(
54            var: Expr_Variable(
55                name: Expr_Variable(
56                    name: a
57                )
58            )
59            dim: Scalar_String(
60                value: b
61            )
62        )
63    )
64)
65