2015-06-13 15:42:09 +02:00
|
|
|
Uniform variable syntax in PHP 7 (misc)
|
|
|
|
-----
|
|
|
|
<?php
|
|
|
|
|
|
|
|
"string"->length();
|
2020-02-22 20:49:11 +01:00
|
|
|
"foo$bar"[0];
|
|
|
|
"foo$bar"->length();
|
2015-06-13 15:42:09 +02:00
|
|
|
(clone $obj)->b[0](1);
|
|
|
|
[0, 1][0] = 1;
|
|
|
|
-----
|
|
|
|
!!php7
|
|
|
|
array(
|
2017-01-19 22:25:22 +01:00
|
|
|
0: Stmt_Expression(
|
|
|
|
expr: Expr_MethodCall(
|
|
|
|
var: Scalar_String(
|
|
|
|
value: string
|
|
|
|
)
|
2017-04-28 19:09:39 +02:00
|
|
|
name: Identifier(
|
|
|
|
name: length
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
args: array(
|
|
|
|
)
|
2015-06-13 15:42:09 +02:00
|
|
|
)
|
|
|
|
)
|
2020-02-22 21:03:53 +01:00
|
|
|
1: Stmt_Expression(
|
2020-02-22 20:49:11 +01:00
|
|
|
expr: Expr_ArrayDimFetch(
|
|
|
|
var: Scalar_Encapsed(
|
|
|
|
parts: array(
|
|
|
|
0: Scalar_EncapsedStringPart(
|
|
|
|
value: foo
|
|
|
|
)
|
|
|
|
1: Expr_Variable(
|
|
|
|
name: bar
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2020-02-22 21:03:53 +01:00
|
|
|
2: Stmt_Expression(
|
2020-02-22 20:49:11 +01:00
|
|
|
expr: Expr_MethodCall(
|
|
|
|
var: Scalar_Encapsed(
|
|
|
|
parts: array(
|
|
|
|
0: Scalar_EncapsedStringPart(
|
|
|
|
value: foo
|
|
|
|
)
|
|
|
|
1: Expr_Variable(
|
|
|
|
name: bar
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
name: Identifier(
|
|
|
|
name: length
|
|
|
|
)
|
|
|
|
args: array(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2020-02-22 21:03:53 +01:00
|
|
|
3: Stmt_Expression(
|
2017-01-19 22:25:22 +01:00
|
|
|
expr: Expr_FuncCall(
|
|
|
|
name: Expr_ArrayDimFetch(
|
|
|
|
var: Expr_PropertyFetch(
|
|
|
|
var: Expr_Clone(
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: obj
|
|
|
|
)
|
2015-06-13 15:42:09 +02:00
|
|
|
)
|
2017-04-28 19:09:39 +02:00
|
|
|
name: Identifier(
|
|
|
|
name: b
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
)
|
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 0
|
2015-06-13 15:42:09 +02:00
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
args: array(
|
|
|
|
0: Arg(
|
2020-08-09 17:37:31 +02:00
|
|
|
name: null
|
2017-01-19 22:25:22 +01:00
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 1
|
|
|
|
)
|
|
|
|
byRef: false
|
|
|
|
unpack: false
|
2015-06-13 15:42:09 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2020-02-22 21:03:53 +01:00
|
|
|
4: Stmt_Expression(
|
2017-01-19 22:25:22 +01:00
|
|
|
expr: Expr_Assign(
|
|
|
|
var: Expr_ArrayDimFetch(
|
|
|
|
var: Expr_Array(
|
|
|
|
items: array(
|
|
|
|
0: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 0
|
|
|
|
)
|
|
|
|
byRef: false
|
2019-05-09 15:11:00 +02:00
|
|
|
unpack: false
|
2015-06-13 15:42:09 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
1: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 1
|
|
|
|
)
|
|
|
|
byRef: false
|
2019-05-09 15:11:00 +02:00
|
|
|
unpack: false
|
2015-06-13 15:42:09 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 0
|
|
|
|
)
|
2015-06-13 15:42:09 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
expr: Scalar_LNumber(
|
|
|
|
value: 1
|
2015-06-13 15:42:09 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
)
|