2011-11-27 11:20:35 +01:00
|
|
|
Logical operators
|
|
|
|
-----
|
|
|
|
<?php
|
|
|
|
|
|
|
|
// boolean ops
|
|
|
|
$a && $b;
|
|
|
|
$a || $b;
|
|
|
|
!$a;
|
|
|
|
!!$a;
|
|
|
|
|
|
|
|
// logical ops
|
|
|
|
$a and $b;
|
|
|
|
$a or $b;
|
|
|
|
$a xor $b;
|
|
|
|
|
|
|
|
// precedence
|
|
|
|
$a && $b || $c && $d;
|
|
|
|
$a && ($b || $c) && $d;
|
|
|
|
|
|
|
|
$a = $b || $c;
|
|
|
|
$a = $b or $c;
|
|
|
|
-----
|
|
|
|
array(
|
2014-02-06 14:44:16 +01:00
|
|
|
0: Expr_BinaryOp_BooleanAnd(
|
2011-11-27 11:20:35 +01:00
|
|
|
left: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
right: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
1: Expr_BinaryOp_BooleanOr(
|
2011-11-27 11:20:35 +01:00
|
|
|
left: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
right: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
|
|
|
2: Expr_BooleanNot(
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
)
|
|
|
|
3: Expr_BooleanNot(
|
|
|
|
expr: Expr_BooleanNot(
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
4: Expr_BinaryOp_LogicalAnd(
|
2011-11-27 11:20:35 +01:00
|
|
|
left: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
right: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
5: Expr_BinaryOp_LogicalOr(
|
2011-11-27 11:20:35 +01:00
|
|
|
left: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
right: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
6: Expr_BinaryOp_LogicalXor(
|
2011-11-27 11:20:35 +01:00
|
|
|
left: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
right: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
7: Expr_BinaryOp_BooleanOr(
|
|
|
|
left: Expr_BinaryOp_BooleanAnd(
|
2011-11-27 11:20:35 +01:00
|
|
|
left: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
right: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
right: Expr_BinaryOp_BooleanAnd(
|
2011-11-27 11:20:35 +01:00
|
|
|
left: Expr_Variable(
|
|
|
|
name: c
|
|
|
|
)
|
|
|
|
right: Expr_Variable(
|
|
|
|
name: d
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
8: Expr_BinaryOp_BooleanAnd(
|
|
|
|
left: Expr_BinaryOp_BooleanAnd(
|
2011-11-27 11:20:35 +01:00
|
|
|
left: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
right: Expr_BinaryOp_BooleanOr(
|
2011-11-27 11:20:35 +01:00
|
|
|
left: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
right: Expr_Variable(
|
|
|
|
name: c
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
right: Expr_Variable(
|
|
|
|
name: d
|
|
|
|
)
|
|
|
|
)
|
|
|
|
9: Expr_Assign(
|
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
expr: Expr_BinaryOp_BooleanOr(
|
2011-11-27 11:20:35 +01:00
|
|
|
left: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
right: Expr_Variable(
|
|
|
|
name: c
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2014-02-06 14:44:16 +01:00
|
|
|
10: Expr_BinaryOp_LogicalOr(
|
2011-11-27 11:20:35 +01:00
|
|
|
left: Expr_Assign(
|
|
|
|
var: Expr_Variable(
|
|
|
|
name: a
|
|
|
|
)
|
|
|
|
expr: Expr_Variable(
|
|
|
|
name: b
|
|
|
|
)
|
|
|
|
)
|
|
|
|
right: Expr_Variable(
|
|
|
|
name: c
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|