php-parser/test/code/parser/expr/comparison.test

129 lines
2.6 KiB
Plaintext
Raw Normal View History

2011-11-27 11:20:35 +01:00
Comparison operators
-----
<?php
$a < $b;
$a <= $b;
$a > $b;
$a >= $b;
$a == $b;
$a === $b;
$a != $b;
$a !== $b;
$a <=> $b;
2011-11-27 11:20:35 +01:00
$a instanceof B;
$a instanceof $b;
-----
array(
2017-01-19 22:25:22 +01:00
0: Stmt_Expression(
expr: Expr_BinaryOp_Smaller(
left: Expr_Variable(
name: a
)
right: Expr_Variable(
name: b
)
2011-11-27 11:20:35 +01:00
)
)
2017-01-19 22:25:22 +01:00
1: Stmt_Expression(
expr: Expr_BinaryOp_SmallerOrEqual(
left: Expr_Variable(
name: a
)
right: Expr_Variable(
name: b
)
2011-11-27 11:20:35 +01:00
)
)
2017-01-19 22:25:22 +01:00
2: Stmt_Expression(
expr: Expr_BinaryOp_Greater(
left: Expr_Variable(
name: a
)
right: Expr_Variable(
name: b
)
2011-11-27 11:20:35 +01:00
)
)
2017-01-19 22:25:22 +01:00
3: Stmt_Expression(
expr: Expr_BinaryOp_GreaterOrEqual(
left: Expr_Variable(
name: a
)
right: Expr_Variable(
name: b
)
2011-11-27 11:20:35 +01:00
)
)
2017-01-19 22:25:22 +01:00
4: Stmt_Expression(
expr: Expr_BinaryOp_Equal(
left: Expr_Variable(
name: a
)
right: Expr_Variable(
name: b
)
2011-11-27 11:20:35 +01:00
)
)
2017-01-19 22:25:22 +01:00
5: Stmt_Expression(
expr: Expr_BinaryOp_Identical(
left: Expr_Variable(
name: a
)
right: Expr_Variable(
name: b
)
2011-11-27 11:20:35 +01:00
)
)
2017-01-19 22:25:22 +01:00
6: Stmt_Expression(
expr: Expr_BinaryOp_NotEqual(
left: Expr_Variable(
name: a
)
right: Expr_Variable(
name: b
)
2011-11-27 11:20:35 +01:00
)
)
2017-01-19 22:25:22 +01:00
7: Stmt_Expression(
expr: Expr_BinaryOp_NotIdentical(
left: Expr_Variable(
name: a
)
right: Expr_Variable(
name: b
)
2011-11-27 11:20:35 +01:00
)
)
2017-01-19 22:25:22 +01:00
8: Stmt_Expression(
expr: Expr_BinaryOp_Spaceship(
left: Expr_Variable(
name: a
)
right: Expr_Variable(
name: b
)
)
)
2017-01-19 22:25:22 +01:00
9: Stmt_Expression(
expr: Expr_Instanceof(
expr: Expr_Variable(
name: a
)
class: Name(
parts: array(
0: B
)
2011-11-27 11:20:35 +01:00
)
)
)
2017-01-19 22:25:22 +01:00
10: Stmt_Expression(
expr: Expr_Instanceof(
expr: Expr_Variable(
name: a
)
class: Expr_Variable(
name: b
)
2011-11-27 11:20:35 +01:00
)
)
2017-01-19 22:25:22 +01:00
)