mirror of
https://github.com/danog/PHP-Parser.git
synced 2024-12-12 09:29:47 +01:00
81 lines
2.2 KiB
Plaintext
81 lines
2.2 KiB
Plaintext
|
Expressions in list()
|
||
|
-----
|
||
|
<?php
|
||
|
|
||
|
// This is legal.
|
||
|
list(($a), ((($b)))) = $x;
|
||
|
// This is illegal, but not a syntax error.
|
||
|
list(1 + 1) = $x;
|
||
|
-----
|
||
|
!!php7
|
||
|
array(
|
||
|
0: Stmt_Expression(
|
||
|
expr: Expr_Assign(
|
||
|
var: Expr_List(
|
||
|
items: array(
|
||
|
0: Expr_ArrayItem(
|
||
|
key: null
|
||
|
value: Expr_Variable(
|
||
|
name: a
|
||
|
)
|
||
|
byRef: false
|
||
|
unpack: false
|
||
|
)
|
||
|
1: Expr_ArrayItem(
|
||
|
key: null
|
||
|
value: Expr_Variable(
|
||
|
name: b
|
||
|
)
|
||
|
byRef: false
|
||
|
unpack: false
|
||
|
)
|
||
|
)
|
||
|
comments: array(
|
||
|
0: // This is legal.
|
||
|
)
|
||
|
)
|
||
|
expr: Expr_Variable(
|
||
|
name: x
|
||
|
)
|
||
|
comments: array(
|
||
|
0: // This is legal.
|
||
|
)
|
||
|
)
|
||
|
comments: array(
|
||
|
0: // This is legal.
|
||
|
)
|
||
|
)
|
||
|
1: Stmt_Expression(
|
||
|
expr: Expr_Assign(
|
||
|
var: Expr_List(
|
||
|
items: array(
|
||
|
0: Expr_ArrayItem(
|
||
|
key: null
|
||
|
value: Expr_BinaryOp_Plus(
|
||
|
left: Scalar_LNumber(
|
||
|
value: 1
|
||
|
)
|
||
|
right: Scalar_LNumber(
|
||
|
value: 1
|
||
|
)
|
||
|
)
|
||
|
byRef: false
|
||
|
unpack: false
|
||
|
)
|
||
|
)
|
||
|
comments: array(
|
||
|
0: // This is illegal, but not a syntax error.
|
||
|
)
|
||
|
)
|
||
|
expr: Expr_Variable(
|
||
|
name: x
|
||
|
)
|
||
|
comments: array(
|
||
|
0: // This is illegal, but not a syntax error.
|
||
|
)
|
||
|
)
|
||
|
comments: array(
|
||
|
0: // This is illegal, but not a syntax error.
|
||
|
)
|
||
|
)
|
||
|
)
|