2012-09-07 19:43:07 +02:00
|
|
|
Array/string dereferencing
|
|
|
|
-----
|
|
|
|
<?php
|
|
|
|
|
|
|
|
"abc"[2];
|
|
|
|
"abc"[2][0][0];
|
|
|
|
|
|
|
|
[1, 2, 3][2];
|
|
|
|
[1, 2, 3][2][0][0];
|
|
|
|
|
|
|
|
array(1, 2, 3)[2];
|
|
|
|
array(1, 2, 3)[2][0][0];
|
2014-08-31 16:14:36 +02:00
|
|
|
|
|
|
|
FOO[0];
|
|
|
|
Foo::BAR[1];
|
|
|
|
$foo::BAR[2][1][0];
|
2012-09-07 19:43:07 +02:00
|
|
|
-----
|
|
|
|
array(
|
2017-01-19 22:25:22 +01:00
|
|
|
0: Stmt_Expression(
|
|
|
|
expr: Expr_ArrayDimFetch(
|
|
|
|
var: Scalar_String(
|
|
|
|
value: abc
|
|
|
|
)
|
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 2
|
|
|
|
)
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
1: Stmt_Expression(
|
|
|
|
expr: Expr_ArrayDimFetch(
|
2012-09-07 19:43:07 +02:00
|
|
|
var: Expr_ArrayDimFetch(
|
2017-01-19 22:25:22 +01:00
|
|
|
var: Expr_ArrayDimFetch(
|
|
|
|
var: Scalar_String(
|
|
|
|
value: abc
|
|
|
|
)
|
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 2
|
|
|
|
)
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
|
|
|
dim: Scalar_LNumber(
|
2017-01-19 22:25:22 +01:00
|
|
|
value: 0
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
2: Stmt_Expression(
|
|
|
|
expr: Expr_ArrayDimFetch(
|
|
|
|
var: Expr_Array(
|
|
|
|
items: array(
|
|
|
|
0: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 1
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
1: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 2
|
|
|
|
)
|
|
|
|
byRef: false
|
|
|
|
)
|
|
|
|
2: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 3
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 2
|
|
|
|
)
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
3: Stmt_Expression(
|
|
|
|
expr: Expr_ArrayDimFetch(
|
2012-09-07 19:43:07 +02:00
|
|
|
var: Expr_ArrayDimFetch(
|
2017-01-19 22:25:22 +01:00
|
|
|
var: Expr_ArrayDimFetch(
|
|
|
|
var: Expr_Array(
|
|
|
|
items: array(
|
|
|
|
0: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 1
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
1: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 2
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
2: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 3
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 2
|
|
|
|
)
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
|
|
|
dim: Scalar_LNumber(
|
2017-01-19 22:25:22 +01:00
|
|
|
value: 0
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
4: Stmt_Expression(
|
|
|
|
expr: Expr_ArrayDimFetch(
|
|
|
|
var: Expr_Array(
|
|
|
|
items: array(
|
|
|
|
0: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 1
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
1: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 2
|
|
|
|
)
|
|
|
|
byRef: false
|
|
|
|
)
|
|
|
|
2: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 3
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 2
|
|
|
|
)
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
5: Stmt_Expression(
|
|
|
|
expr: Expr_ArrayDimFetch(
|
2012-09-07 19:43:07 +02:00
|
|
|
var: Expr_ArrayDimFetch(
|
2017-01-19 22:25:22 +01:00
|
|
|
var: Expr_ArrayDimFetch(
|
|
|
|
var: Expr_Array(
|
|
|
|
items: array(
|
|
|
|
0: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 1
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
1: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 2
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
2: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Scalar_LNumber(
|
|
|
|
value: 3
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 2
|
|
|
|
)
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
|
|
|
dim: Scalar_LNumber(
|
2017-01-19 22:25:22 +01:00
|
|
|
value: 0
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
6: Stmt_Expression(
|
|
|
|
expr: Expr_ArrayDimFetch(
|
|
|
|
var: Expr_ConstFetch(
|
|
|
|
name: Name(
|
|
|
|
parts: array(
|
|
|
|
0: FOO
|
|
|
|
)
|
2014-08-31 16:14:36 +02:00
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 0
|
|
|
|
)
|
2014-08-31 16:14:36 +02:00
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
7: Stmt_Expression(
|
|
|
|
expr: Expr_ArrayDimFetch(
|
|
|
|
var: Expr_ClassConstFetch(
|
|
|
|
class: Name(
|
|
|
|
parts: array(
|
|
|
|
0: Foo
|
|
|
|
)
|
2014-08-31 16:14:36 +02:00
|
|
|
)
|
2017-04-28 19:09:39 +02:00
|
|
|
name: Identifier(
|
|
|
|
name: BAR
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
)
|
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 1
|
2014-08-31 16:14:36 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
8: Stmt_Expression(
|
|
|
|
expr: Expr_ArrayDimFetch(
|
2014-08-31 16:14:36 +02:00
|
|
|
var: Expr_ArrayDimFetch(
|
2017-01-19 22:25:22 +01:00
|
|
|
var: Expr_ArrayDimFetch(
|
|
|
|
var: Expr_ClassConstFetch(
|
|
|
|
class: Expr_Variable(
|
|
|
|
name: foo
|
|
|
|
)
|
2017-04-28 19:09:39 +02:00
|
|
|
name: Identifier(
|
|
|
|
name: BAR
|
|
|
|
)
|
2017-01-19 22:25:22 +01:00
|
|
|
)
|
|
|
|
dim: Scalar_LNumber(
|
|
|
|
value: 2
|
2014-08-31 16:14:36 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
dim: Scalar_LNumber(
|
2017-01-19 22:25:22 +01:00
|
|
|
value: 1
|
2014-08-31 16:14:36 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
dim: Scalar_LNumber(
|
2017-01-19 22:25:22 +01:00
|
|
|
value: 0
|
2014-08-31 16:14:36 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2012-09-07 19:43:07 +02:00
|
|
|
)
|