1
0
mirror of https://github.com/danog/PHP-Parser.git synced 2024-12-04 10:18:09 +01:00
PHP-Parser/test/code/parser/stmt/loop/for.test
Nikita Popov e4b837e0c4 Split up pretty printer test in stmt/expr
The list was getting unweildly.

Also improve error message when parsing fails in pretty printer
test and extend some tests.
2015-10-02 11:16:12 +02:00

98 lines
1.7 KiB
Plaintext

For loop
-----
<?php
// "classical" loop
for ($i = 0; $i < $c; ++$i) {}
// multiple expressions
for ($a, $b; $c, $d; $e, $f) {}
// infinite loop
for (;;) {}
// alternative syntax
for (;;):
endfor;
-----
array(
0: Stmt_For(
init: array(
0: Expr_Assign(
var: Expr_Variable(
name: i
)
expr: Scalar_LNumber(
value: 0
)
)
)
cond: array(
0: Expr_BinaryOp_Smaller(
left: Expr_Variable(
name: i
)
right: Expr_Variable(
name: c
)
)
)
loop: array(
0: Expr_PreInc(
var: Expr_Variable(
name: i
)
)
)
stmts: array(
)
)
1: Stmt_For(
init: array(
0: Expr_Variable(
name: a
)
1: Expr_Variable(
name: b
)
)
cond: array(
0: Expr_Variable(
name: c
)
1: Expr_Variable(
name: d
)
)
loop: array(
0: Expr_Variable(
name: e
)
1: Expr_Variable(
name: f
)
)
stmts: array(
)
)
2: Stmt_For(
init: array(
)
cond: array(
)
loop: array(
)
stmts: array(
)
)
3: Stmt_For(
init: array(
)
cond: array(
)
loop: array(
)
stmts: array(
)
)
)