mirror of
https://github.com/danog/PHP-Parser.git
synced 2024-12-12 09:29:47 +01:00
81e53ce0ff
This changset also adds unit tests for Comments and adds a way to test the pretty printer.
86 lines
1.4 KiB
Plaintext
86 lines
1.4 KiB
Plaintext
For loop
|
|
-----
|
|
<?php
|
|
|
|
// "classical" loop
|
|
for ($i = 0; $i < $c; ++$i) {}
|
|
|
|
// multiple expressions
|
|
for (;$a,$b;) {}
|
|
|
|
// 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_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(
|
|
)
|
|
cond: array(
|
|
0: Expr_Variable(
|
|
name: a
|
|
)
|
|
1: Expr_Variable(
|
|
name: b
|
|
)
|
|
)
|
|
loop: array(
|
|
)
|
|
stmts: array(
|
|
)
|
|
)
|
|
2: Stmt_For(
|
|
init: array(
|
|
)
|
|
cond: array(
|
|
)
|
|
loop: array(
|
|
)
|
|
stmts: array(
|
|
)
|
|
)
|
|
3: Stmt_For(
|
|
init: array(
|
|
)
|
|
cond: array(
|
|
)
|
|
loop: array(
|
|
)
|
|
stmts: array(
|
|
)
|
|
)
|
|
) |