1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-04 10:18:09 +01:00
PHP-Parser/test/code/parser/expr/arrayDef.test

139 lines
3.0 KiB
Plaintext
Raw Normal View History

2011-11-27 11:20:35 +01:00
Array definitions
-----
<?php
array();
2011-12-07 18:17:05 +01:00
array('a');
array('a', );
array('a', 'b');
array('a', &$b, 'c' => 'd', 'e' => &$f);
2011-11-27 11:20:35 +01:00
2011-12-07 18:17:05 +01:00
// short array syntax
2011-11-27 11:20:35 +01:00
[];
[1, 2, 3];
['a' => 'b'];
-----
array(
0: Expr_Array(
items: array(
)
)
1: Expr_Array(
items: array(
0: Expr_ArrayItem(
key: null
2011-12-07 18:17:05 +01:00
value: Scalar_String(
value: a
2011-11-27 11:20:35 +01:00
)
byRef: false
)
)
)
2: Expr_Array(
items: array(
0: Expr_ArrayItem(
2011-12-07 18:17:05 +01:00
key: null
2011-11-27 11:20:35 +01:00
value: Scalar_String(
2011-12-07 18:17:05 +01:00
value: a
2011-11-27 11:20:35 +01:00
)
byRef: false
)
)
)
3: Expr_Array(
items: array(
0: Expr_ArrayItem(
2011-12-07 18:17:05 +01:00
key: null
2011-11-27 11:20:35 +01:00
value: Scalar_String(
2011-12-07 18:17:05 +01:00
value: a
2011-11-27 11:20:35 +01:00
)
byRef: false
)
1: Expr_ArrayItem(
key: null
value: Scalar_String(
2011-12-07 18:17:05 +01:00
value: b
2011-11-27 11:20:35 +01:00
)
byRef: false
)
)
)
4: Expr_Array(
items: array(
0: Expr_ArrayItem(
2011-12-07 18:17:05 +01:00
key: null
value: Scalar_String(
2011-11-27 11:20:35 +01:00
value: a
)
2011-12-07 18:17:05 +01:00
byRef: false
)
1: Expr_ArrayItem(
key: null
2011-11-27 11:20:35 +01:00
value: Expr_Variable(
name: b
)
byRef: true
2011-12-07 18:17:05 +01:00
)
2: Expr_ArrayItem(
key: Scalar_String(
value: c
)
value: Scalar_String(
value: d
)
byRef: false
)
3: Expr_ArrayItem(
key: Scalar_String(
value: e
)
value: Expr_Variable(
name: f
)
byRef: true
2011-11-27 11:20:35 +01:00
)
)
)
5: Expr_Array(
items: array(
)
)
6: Expr_Array(
items: array(
0: Expr_ArrayItem(
key: null
value: Scalar_LNumber(
value: 1
)
byRef: false
)
1: Expr_ArrayItem(
key: null
value: Scalar_LNumber(
value: 2
)
byRef: false
)
2: Expr_ArrayItem(
key: null
value: Scalar_LNumber(
value: 3
)
byRef: false
)
)
)
7: Expr_Array(
items: array(
0: Expr_ArrayItem(
key: Scalar_String(
value: a
)
value: Scalar_String(
value: b
)
byRef: false
)
)
)
)