2011-11-27 11:20:35 +01:00
|
|
|
Assignments
|
|
|
|
-----
|
|
|
|
<?php
|
|
|
|
// simple assign
|
|
|
|
$a = $b;
|
|
|
|
|
|
|
|
// combined assign
|
|
|
|
$a &= $b;
|
|
|
|
$a |= $b;
|
|
|
|
$a ^= $b;
|
|
|
|
$a .= $b;
|
|
|
|
$a /= $b;
|
|
|
|
$a -= $b;
|
|
|
|
$a %= $b;
|
|
|
|
$a *= $b;
|
|
|
|
$a += $b;
|
|
|
|
$a <<= $b;
|
|
|
|
$a >>= $b;
|
2014-03-26 19:18:16 +01:00
|
|
|
$a **= $b;
|
|
|
|
|
|
|
|
// chained assign
|
|
|
|
$a = $b *= $c **= $d;
|
2011-11-27 11:20:35 +01:00
|
|
|
|
|
|
|
// by ref assign
|
|
|
|
$a =& $b;
|
|
|
|
|
|
|
|
// list() assign
|
|
|
|
list($a) = $b;
|
|
|
|
list($a, , $b) = $c;
|
|
|
|
list($a, list(, $c), $d) = $e;
|
|
|
|
|
|
|
|
// inc/dec
|
|
|
|
++$a;
|
|
|
|
$a++;
|
|
|
|
--$a;
|
|
|
|
$a--;
|
|
|
|
-----
|
|
|
|
array(
|
|
|
|
0: Expr_Assign(
|
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
2016-03-09 18:57:16 +01:00
|
|
|
comments: array(
|
|
|
|
0: // simple assign
|
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
2016-03-09 18:57:16 +01:00
|
|
|
comments: array(
|
|
|
|
0: // simple assign
|
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
1: Expr_AssignOp_BitwiseAnd(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
2016-03-09 18:57:16 +01:00
|
|
|
comments: array(
|
|
|
|
0: // combined assign
|
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
2016-03-09 18:57:16 +01:00
|
|
|
comments: array(
|
|
|
|
0: // combined assign
|
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
2: Expr_AssignOp_BitwiseOr(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
3: Expr_AssignOp_BitwiseXor(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
4: Expr_AssignOp_Concat(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
5: Expr_AssignOp_Div(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
6: Expr_AssignOp_Minus(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
7: Expr_AssignOp_Mod(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
8: Expr_AssignOp_Mul(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
9: Expr_AssignOp_Plus(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
10: Expr_AssignOp_ShiftLeft(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
11: Expr_AssignOp_ShiftRight(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-03-26 19:18:16 +01:00
|
|
|
12: Expr_AssignOp_Pow(
|
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
|
|
|
13: Expr_Assign(
|
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
2016-03-09 18:57:16 +01:00
|
|
|
comments: array(
|
|
|
|
0: // chained assign
|
|
|
|
)
|
2014-03-26 19:18:16 +01:00
|
|
|
)
|
|
|
|
expr: Expr_AssignOp_Mul(
|
|
|
|
var: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
expr: Expr_AssignOp_Pow(
|
|
|
|
var: Expr_Variable(
|
|
|
|
name: c
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: d
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2016-03-09 18:57:16 +01:00
|
|
|
comments: array(
|
|
|
|
0: // chained assign
|
|
|
|
)
|
2014-03-26 19:18:16 +01:00
|
|
|
)
|
|
|
|
14: Expr_AssignRef(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
2016-03-09 18:57:16 +01:00
|
|
|
comments: array(
|
|
|
|
0: // by ref assign
|
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
2016-03-09 18:57:16 +01:00
|
|
|
comments: array(
|
|
|
|
0: // by ref assign
|
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
2016-08-30 22:11:06 +02:00
|
|
|
15: Expr_Assign(
|
2012-09-07 17:22:43 +02:00
|
|
|
var: Expr_List(
|
2016-07-09 21:54:15 +02:00
|
|
|
items: array(
|
|
|
|
0: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 17:22:43 +02:00
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
2016-03-09 18:57:16 +01:00
|
|
|
comments: array(
|
|
|
|
0: // list() assign
|
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
2016-03-09 18:57:16 +01:00
|
|
|
comments: array(
|
|
|
|
0: // list() assign
|
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
2016-08-30 22:11:06 +02:00
|
|
|
16: Expr_Assign(
|
2012-09-07 17:22:43 +02:00
|
|
|
var: Expr_List(
|
2016-07-09 21:54:15 +02:00
|
|
|
items: array(
|
|
|
|
0: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 17:22:43 +02:00
|
|
|
)
|
|
|
|
1: null
|
2016-07-09 21:54:15 +02:00
|
|
|
2: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 17:22:43 +02:00
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: c
|
|
|
|
)
|
|
|
|
)
|
2016-08-30 22:11:06 +02:00
|
|
|
17: Expr_Assign(
|
2012-09-07 17:22:43 +02:00
|
|
|
var: Expr_List(
|
2016-07-09 21:54:15 +02:00
|
|
|
items: array(
|
|
|
|
0: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 17:22:43 +02:00
|
|
|
)
|
2012-09-07 23:21:23 +02:00
|
|
|
1: Expr_List(
|
2016-07-09 21:54:15 +02:00
|
|
|
items: array(
|
2012-09-07 23:21:23 +02:00
|
|
|
0: null
|
2016-07-09 21:54:15 +02:00
|
|
|
1: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Expr_Variable(
|
|
|
|
name: c
|
|
|
|
)
|
|
|
|
byRef: false
|
2012-09-07 23:21:23 +02:00
|
|
|
)
|
2012-09-07 17:22:43 +02:00
|
|
|
)
|
|
|
|
)
|
2016-07-09 21:54:15 +02:00
|
|
|
2: Expr_ArrayItem(
|
|
|
|
key: null
|
|
|
|
value: Expr_Variable(
|
|
|
|
name: d
|
|
|
|
)
|
|
|
|
byRef: false
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: e
|
|
|
|
)
|
|
|
|
)
|
2016-08-30 22:11:06 +02:00
|
|
|
18: Expr_PreInc(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
2016-03-09 18:57:16 +01:00
|
|
|
comments: array(
|
|
|
|
0: // inc/dec
|
|
|
|
)
|
2011-11-27 11:20:35 +01:00
|
|
|
)
|
2016-08-30 22:11:06 +02:00
|
|
|
19: Expr_PostInc(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
)
|
2016-08-30 22:11:06 +02:00
|
|
|
20: Expr_PreDec(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
)
|
2016-08-30 22:11:06 +02:00
|
|
|
21: Expr_PostDec(
|
2011-11-27 11:20:35 +01:00
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|