projects
/
yaffs-website
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
4ca76b21665fa98094a0ad1f83ccd07ad5870f54
[yaffs-website]
/
vendor
/
nikic
/
php-parser
/
test
/
code
/
parser
/
expr
/
arrayDestructuring.test
1
Array destructuring
2
-----
3
<?php
4
5
[$a, $b] = [$c, $d];
6
[, $a, , , $b, ,] = $foo;
7
[, [[$a]], $b] = $bar;
8
['a' => $b, 'b' => $a] = $baz;
9
-----
10
!!php7
11
array(
12
0: Expr_Assign(
13
var: Expr_Array(
14
items: array(
15
0: Expr_ArrayItem(
16
key: null
17
value: Expr_Variable(
18
name: a
19
)
20
byRef: false
21
)
22
1: Expr_ArrayItem(
23
key: null
24
value: Expr_Variable(
25
name: b
26
)
27
byRef: false
28
)
29
)
30
)
31
expr: Expr_Array(
32
items: array(
33
0: Expr_ArrayItem(
34
key: null
35
value: Expr_Variable(
36
name: c
37
)
38
byRef: false
39
)
40
1: Expr_ArrayItem(
41
key: null
42
value: Expr_Variable(
43
name: d
44
)
45
byRef: false
46
)
47
)
48
)
49
)
50
1: Expr_Assign(
51
var: Expr_Array(
52
items: array(
53
0: null
54
1: Expr_ArrayItem(
55
key: null
56
value: Expr_Variable(
57
name: a
58
)
59
byRef: false
60
)
61
2: null
62
3: null
63
4: Expr_ArrayItem(
64
key: null
65
value: Expr_Variable(
66
name: b
67
)
68
byRef: false
69
)
70
5: null
71
)
72
)
73
expr: Expr_Variable(
74
name: foo
75
)
76
)
77
2: Expr_Assign(
78
var: Expr_Array(
79
items: array(
80
0: null
81
1: Expr_ArrayItem(
82
key: null
83
value: Expr_Array(
84
items: array(
85
0: Expr_ArrayItem(
86
key: null
87
value: Expr_Array(
88
items: array(
89
0: Expr_ArrayItem(
90
key: null
91
value: Expr_Variable(
92
name: a
93
)
94
byRef: false
95
)
96
)
97
)
98
byRef: false
99
)
100
)
101
)
102
byRef: false
103
)
104
2: Expr_ArrayItem(
105
key: null
106
value: Expr_Variable(
107
name: b
108
)
109
byRef: false
110
)
111
)
112
)
113
expr: Expr_Variable(
114
name: bar
115
)
116
)
117
3: Expr_Assign(
118
var: Expr_Array(
119
items: array(
120
0: Expr_ArrayItem(
121
key: Scalar_String(
122
value: a
123
)
124
value: Expr_Variable(
125
name: b
126
)
127
byRef: false
128
)
129
1: Expr_ArrayItem(
130
key: Scalar_String(
131
value: b
132
)
133
value: Expr_Variable(
134
name: a
135
)
136
byRef: false
137
)
138
)
139
)
140
expr: Expr_Variable(
141
name: baz
142
)
143
)
144
)